Re: admin site problem
On Nov 17, 8:35 pm, Daniel Roseman <[EMAIL PROTECTED]> wrote: > On Nov 17, 12:41 pm, Vicky <[EMAIL PROTECTED]> wrote: > > > I found the problem.. I used : > > > def __unicode__(self): > > > function in my model. so it a can return only sting values. So if i > > need to return a column of type integer or contains a foreign key how > > should i do it?? > > return u'%s' % self.my_integer_attribute > or > return unicode(self.my_integer_attribute) > > This is fairly basic Python. I'd recommend going through a Python > tutorial if you don't know any of this:www.diveintopython.orgis a > great one. > > For foreign keys, Django uses the unicode of the related model anyway. > -- > DR. Thanks a lot guys. Actually am working on a project that uses django. I didn't have much time to learn python. just went through the things i need for the project. hope will learn it soon :) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: admin site problem
On Nov 17, 12:41 pm, Vicky <[EMAIL PROTECTED]> wrote: > I found the problem.. I used : > > def __unicode__(self): > > function in my model. so it a can return only sting values. So if i > need to return a column of type integer or contains a foreign key how > should i do it?? > return u'%s' % self.my_integer_attribute or return unicode(self.my_integer_attribute) This is fairly basic Python. I'd recommend going through a Python tutorial if you don't know any of this: www.diveintopython.org is a great one. For foreign keys, Django uses the unicode of the related model anyway. -- DR. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: admin site problem
You need to turn it into a string, this will do it: def __unicode(self): return '%s' % self.integer_column On Nov 17, 12:41 pm, Vicky <[EMAIL PROTECTED]> wrote: > I found the problem.. I used : > > def __unicode__(self): > > function in my model. so it a can return only sting values. So if i > need to return a column of type integer or contains a foreign key how > should i do it?? > > On Nov 17, 4:28 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote: > > > Vicky wrote: > > > I tried to add some values to my table from admin site. Table has 3 > > > columns one of integer type and other two of string type. When i tried > > > to save my entries it giving an error as: > > > > "coercing to Unicode: need string or buffer, int found" > > > > How to solve it? > > > That all depends on what your model looks like? > > /L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: admin site problem
I found the problem.. I used : def __unicode__(self): function in my model. so it a can return only sting values. So if i need to return a column of type integer or contains a foreign key how should i do it?? On Nov 17, 4:28 pm, Lars Stavholm <[EMAIL PROTECTED]> wrote: > Vicky wrote: > > I tried to add some values to my table from admin site. Table has 3 > > columns one of integer type and other two of string type. When i tried > > to save my entries it giving an error as: > > > "coercing to Unicode: need string or buffer, int found" > > > How to solve it? > > That all depends on what your model looks like? > /L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: admin site problem
Vicky wrote: > I tried to add some values to my table from admin site. Table has 3 > columns one of integer type and other two of string type. When i tried > to save my entries it giving an error as: > > "coercing to Unicode: need string or buffer, int found" > > How to solve it? That all depends on what your model looks like? /L --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---