from treebeard.mp_tree import MP_Node
@python_2_unicode_compatible[docs]class AbstractCategory(MP_Node): """ A product category. Merely used for navigational purposes; has no effects on business logic. Uses django-treebeard. """ name = models.CharField(_('Name'), max_length=255, db_index=True) description = models.TextField(_('Description'), blank=True) image = models.ImageField(_('Image'), upload_to='categories', blank=True, null=True, max_length=255) slug = models.SlugField(_('Slug'), max_length=255, db_index=True)Following is the queryset:>>>cat=category.objects.get(pk=11)
>>> cat
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/pinakee/oscar_v1/lib/python2.7/site-packages/django/db/models/base.py", line 496, in __repr__
u = six.text_type(self)
File "/home/pinakee/oscar_v1/lib/python2.7/site-packages/oscar/apps/catalogue/abstract_models.py", line 102, in __str__
return self.full_name
File "/home/waltzz/jivaana/jivaana_custom/catalogue/models.py", line 61, in full_name
cache_key = self.slug + '_full_name'
TypeError: unsupported operand type(s) for +: 'long' and 'str'
>>> cat.slug
3L
The reason above exception is coming because cat.slug is long and not string as it is supposed to be.MySQL Version:mysql -V
mysql Ver 14.14 Distrib 5.5.48, for Linux (x86_64) using readline 5.1
OS:2.6.32-504.30.3.el6.x86_64
Thanks.
Hi,
this is very strange of course. I doubt it has anything to do with MySQL, because even if MySQL had done something wrong and had returned a long in place of a string, the Django ORM should have caught that and raised an error earlier. So the problem must be in Django. (But of course with such a strange problem anything is possible).
I'd first try to clean up the Python compiled files (remove them), remove and recreate the virtualenv, and restart Django. Also check the disk space in the machine.
Regards,
Antonis
Antonis Christofides http://djangodeployment.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0fb7769f-409a-4951-9e2d-4807f0873c16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.