django-categories
django-categories copied to clipboard
ValueError at /admin/categories/category/add/
When using the Admin to create a new category the following traceback occurs
this is the line that is causing issues
decendant_ids = self.instance.get_descendants().values_list('id', flat=True)
versions django==1.8.3 django-mptt==0.7.4 django-categories==1.3 # installed directly from the git repo
Note that using the ORM works: Category(name='whatever').save() works
I'm having this same issue as well. I think it has to do with changes to the django-mptt module (https://github.com/django-mptt/django-mptt). Seems like the error message is part of code that is new to the 0.7.x branch. Unfortunately, if you try to go back to 0.6.x it breaks Django 1.8!
My Python / Django skills are not good enough to fix this. Any help will be apprecited.
I'm testing, but this has worked for me.
Line 111 in base.py
-------------------------
decendant_ids = self.instance.get_descendants().values_list('id', flat=True)
to:
if self.instance.pk:
decendant_ids = self.instance.get_descendants().values_list('id', flat=True)
else:
decendant_ids = []
https://github.com/callowayproject/django-categories/pull/99
+1
yet another +1