def __unicode__(self):return "%s %s %s" % (self.poll_name)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
That is wrong, you have a placeholder for three args and just pass one
to the string formatting. Moreover, you don't even need that here.
def __unicode__(self):
return self.poll_name
Probably a fast-reply kind of error, but that could lead the original
poster to even get more issues than helping him to solve it.
Regards,
--
Fabián E. Gallina
http://www.anue.biz
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
> I am getting this
>
>>>>Poll.objects.all()
> [<Poll: Poll object>]
What do you get when you do:
print unicode(Poll.objects.all()[0])
?
Regards
Roman
the __unicode__ thing is nothing django-specific. It works in plain
python as well:
It's supposed to work like this:
>>> class TestClass(object):
... def __unicode__(self):
... return "unicode"
... def __repr__(self):
... return "buh"
... def __str__(self):
... return "str"
...
>>> o=TestClass()
>>> o
buh
>>> print o
str
>>> print unicode(o)
unicode
>>>
2011/5/17 maaz muqri <mmu...@mshahtech.com>:
What do you get when you try:
>>> p = Poll.objects.all()[0]
>>> p
>>> type(p)
>>> dir(p)
Try this too:
>>> p = Poll.objects.all()
>>> for x in p:
. . . print x (indent this line four spaces, hit return key once)
. . . (hit return key again)
Does any of that help?
Good luck!
Cheers,
Micky
By the way, I just checked django.VERSION and it's (1, 6, 0, 'alpha', 0)So, since version 1.6 is supposed to fully support python 3, I should be fine. Obviously, being 'alpha' means I'll run into trouble, but I'll keep checking out new versions as I learn so by the time 1.6 is really out, I'll be all set.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8aa3f7ef-4252-494e-9334-9f40578a5e8e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
bash-3.2$ python manage.py shell
Python 2.7.6 (default, Dec 19 2013, 06:00:47)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll, Choice
>>> Poll.objects.all()
[<Poll: Poll object>, <Poll: Poll object>]
>>> exit()
bash-3.2$ python manage.py shell
Python 2.7.6 (default, Dec 19 2013, 06:00:47)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from polls.models import Poll, Choice
>>> Poll.objects.all()
[<Poll: Poll object>, <Poll: Poll object>]
>>>
Any help would be great...--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/114e5208-81b6-4068-82df-853176ebfd68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/114e5208-81b6-4068-82df-853176ebfd68%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.