Are you runing python 2.7.x ? Think in python 3 compatibility and solve
your problem
This code can help you.
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class MyModel(models.Model):
name = models.CharFie
On 3/04/2015 12:01 AM, temiloluwa adesina wrote:
Hello
I just joined this group and i have problems with representing multiple
fields in admin using __unicode__, when i try to call this data it
returns just one of them:
|
classCrop(models.Model):
name =models.CharField(max_length=30)
i
Thanks for your reply i found another way to do it, i could just make it
work like this:
b= Crop.objects.all()
nm= b.name
imp= b.importance
cuv= b.cultivation
realized this would help me retrieve the individual data that i wanted to
get.
On Thursday, April 2, 2015 at 3:57:18 PM UTC+1, Filipe X
Not sure I understood the problem. Are you trying to print only the data in
the "importance" field?
If so, try:
class Crop(models.Model):
name = models.CharField(max_length=30)
importance = models.TextField()
cultivation = models.TextField()
def __unicode__(self):
return u'
Hello
I just joined this group and i have problems with representing multiple
fields in admin using __unicode__, when i try to call this data it returns
just one of them:
class Crop(models.Model):
name = models.CharField(max_length=30)
importance = models.TextField()
cultivation = m
5 matches
Mail list logo