You redeclaring your Model classes, and you don't need to. By doing so, the
'self' inside your __unicode__ function refers to a property that isn't
defined (since you redeclared the original class that had the property).
Here is what the model should look like: http://codepad.org/P21ZNkZY

On Fri, Apr 6, 2012 at 3:32 PM, Gerald Klein <j...@zognet.com> wrote:

> Hi and thanks for the response here is the code minus the line numbers --
> copied from vim, all my tabs are right and I had the right underscores.
>
>
> Please let me know if you see something.
>
> thanks again
>
> --jerry
>
>  class Poll(models.Model):
>   8     question = models.CharField(max_length=200)
>   9     pub_date = models.DateTimeField('date published')
>  10
>  11 class Choice(models.Model):
>  12     poll = models.ForeignKey(Poll)
>  13     choice = models.CharField(max_length=200)
>  14     votes = models.IntegerField()
>  15
>  16 class Poll(models.Model):
>  17     def __unicode__(self):
>  18         return self.question
>  19     def was_published_recently(self):
>  20         return self.pub_date >= timezone.now() -
> datetime.timedelta(days=1)
>  21
>  22 class Choice(models.Model):
>  23     def __unicode__(self):
>  24         return self.choice
>
> On Fri, Apr 6, 2012 at 1:54 PM, Jonathan Baker <
> jonathandavidba...@gmail.com> wrote:
>
>> Jerry,
>>
>> You'll want to be sure your method is defined as:
>>
>> def __unicode__(self):
>>     return self.name # I'm using 'name' as an example field
>>
>> with double underscores on both sides of 'unicode' instead of just in
>> front of it.
>>
>> Hope this helps,
>> Jonathan
>>
>> On Fri, Apr 6, 2012 at 12:13 PM, jk121960 <jk121...@gmail.com> wrote:
>>
>>> Hi, I am going through the tutorial, I am experienced programmer and I
>>> am learning django. Every thing was fine till the portion where you
>>> add the __unicode() methods to the classes. When I execute the
>>> Poll.objects.all() ant the command line it doesn't look any
>>> different."[<Poll: Poll object>]" just like the first python console
>>> example. I tried to run syncdb thinking this was what was missing but
>>> it didn't help. It stated that it
>>> "Creating tables ...
>>> Installing custom SQL ...
>>> Installing indexes ...
>>> Installed 0 object(s) from 0 fixture(s)"
>>>
>>> like before but no change to the output in python. Can someone suggest
>>> something so that I can move on from this part, I worked with this
>>> some time back but was unable to utilize it. I am attempting to change
>>> that now, ao I was going back through the lessons.
>>>
>>>
>>> thanks and any help is appreciated
>>>
>>> --jerry
>>>
>>> --
>>> 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.
>>>
>>>
>>
>>
>> --
>> Jonathan D. Baker
>> Web Developer
>> http://jonathandbaker.com
>> 303.257.4144
>>
>> --
>> 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.
>>
>
>
>
> --
>
> Gerald Klein DBA****
>
> contac...@geraldklein.com
>
> www.geraldklein.com <http://geraldklein.com/>****
>
> j...@zognet.com****
>
> 708-599-0352****
>
>
> Linux registered user #548580
>
>
>
>  --
> 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.
>



-- 
Jonathan D. Baker
Web Developer
http://jonathandbaker.com
303.257.4144

-- 
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.

Reply via email to