On Mon, Feb 9, 2009 at 6:58 PM, jfmxl <jf...@yahoo.com> wrote:
>
> Hello,
>
> I downloaded the 1.0.2 version of django to my ubuntu 8.10 box and
> began the tutorial. I got as far as adding the unicode print
> definitions for poll and choice, and then saw no difference between
> afterward :
>
> In [2]: Poll.objects.all()
> Out[2]: [<Poll: Poll object>]
>
> is still what I saw.

What were you expecting to see? This output indicates that you are
using the default __unicode__ method for the Poll object, which won't
be printing any detail of the object itself - just the fact that it is
a Poll object.

If you retrieve an individual object from the list that has been
returned, you will be able to interrogate the individual fields of
that object, and you should find that they hold unicode data.

Alternatively, you can provide a definition for the __unicode__()
method for the Poll class, and it will print whatever you desire (for
example the poll title, not just "Poll object")

> Can you imagine what they problem might be?

No problem here - just a misunderstanding of usage. I'm guessing
you're new to Python - by way of guidance, this isn't a
Django-specific feature. It's a part of the way the Python shell tells
you what objects you are working with. You may find it illuminating to
dig into the Python documentation around the __unicode__, __str__ and
__repr__ methods.

Yours,
Russ Magee %-)

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