Re: Novice. - _unicode_(self) not working. :(

2009-04-05 Thread Antoni Aloy

2009/4/5 Nandha :
>
> Hi,
>
> I just started trying out Django. I am new to python too.!!
>
> I started with poll app in the tutorial.
>
> Adding _unicode_(self):  does not seem to change anything. I saw that
> it could be because i am using older version so i followed the
> installation guide and installed the development version.
>
> Did not help!!
>
> This is the models.py
> class Poll(models.Model):
>        question = models.CharField(max_length=200)
>        pub_date = models.DateTimeField('date_published')
>        def  _unicode_(self):

__unicode__(self)

with two underscores

-- 
Antoni Aloy López
Blog: http://trespams.com
Site: http://apsl.net

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Novice. - _unicode_(self) not working. :(

2009-04-05 Thread Nandha

Hi,

I just started trying out Django. I am new to python too.!!

I started with poll app in the tutorial.

Adding _unicode_(self):  does not seem to change anything. I saw that
it could be because i am using older version so i followed the
installation guide and installed the development version.

Did not help!!

This is the models.py
class Poll(models.Model):
question = models.CharField(max_length=200)
pub_date = models.DateTimeField('date_published')
def  _unicode_(self):
return self.question
def was_published_today(self):
return self.pub_date.date() == datetime.date.today()


The Poll.objects.all()
gives

>>> Poll.objects.all()
[]

What am i missing??

Nandha




--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---