django-tagulous icon indicating copy to clipboard operation
django-tagulous copied to clipboard

Can not add single character parent tag.

Open hepasido opened this issue 6 years ago • 1 comments

Django 1.11.3 django-tagulous 0.13.2

class Media(models.Model):
    tags = tagulous.models.TagField(
        space_delimiter=False,
        tree=True,
        related_name='medias',
        blank=True
    )
>>> Media.tags.tag_model.objects.create(name='r')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "D:\virtual_env\lib\site-packages\django\db\models\manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "D:\virtual_env\lib\site-packages\django\db\models\query.py", line 394, in create
    obj.save(force_insert=True, using=self.db)
  File "D:\virtual_env\lib\site-packages\tagulous\models\models.py", line 711, in save
    self.label = parts[-1]
IndexError: list index out of range

Looks like utils.split_tree_name returns an empty list.

hepasido avatar Aug 01 '18 01:08 hepasido

This is probably related to #81 .

mcrot avatar Oct 15 '19 11:10 mcrot