Hi Antonis,

Thanks for your response:

Following is the model:

from treebeard.mp_tree import MP_Node

@python_2_unicode_compatible
[docs] 
<http://django-oscar.readthedocs.io/en/releases-1.1/ref/apps/catalogue.html#oscar.apps.catalogue.abstract_models.AbstractCategory>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.


On Friday, October 6, 2017 at 11:49:04 PM UTC+5:30, Antonis Christofides 
wrote:
>
> Hi,
>
> could you show the code that defines the slugfield, the queryset that is 
> returning the wrong value, full error message and traceback (if available), 
> and the version of your OS and RDBMS?
>
> It doesn't matter if the problem is more general; let's focus on one 
> specific manifestation of it.
>
> Regards,
>
> Antonis
>
> On October 6, 2017 8:16:20 PM GMT+03:00, Web Architect <[email protected] 
> <javascript:>> wrote:
>>
>> Hi,
>>
>> We have running an ecommerce site using Django 1.8.13. It has been 
>> running fine for a year. But suddenly the django querysets are returning 
>> corrupted values. I am completely clueless why this is happening. Like a 
>> model field is of type SlugField but queryset is returning long. 
>>
>> Would really appreciate if anyone could throw some light on how to fix 
>> the above issue. When I check the values in MySQL DB using PhpMyAdmin and 
>> everything is fine. 
>>
>> Thanks,
>> Pinakee
>>
>>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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.

Reply via email to