Re: __unicode__() addition not working in basic poll application.

2014-03-27 Thread Matheus Henrique Oliveira
Hi Steve. The __unicode__ method must be within the model class. I took your code and applied the fix. http://pastebin.com/sH2J50jS 2014-03-27 7:06 GMT-03:00 Steve Evans <00sev...@gmail.com>: > Hi I am having the same issue: > > I am using Python 2.7, and Django 1.6. > > Here is my code for

Re: __unicode__() addition not working in basic poll application.

2014-03-27 Thread Steve Evans
Thankyou! so much...! It was because i had tabs instead of 4 spaces for the indents. So basically it was an indentation error but it didn't say that in the console. I think this will fix a lot of other peoples problems if they are using tabs instead of spaces for indentations. Cheers. On Thur

Re: __unicode__() addition not working in basic poll application.

2014-03-27 Thread Shai Efrati
i wonder if it is just the formatting of the email, but i think you missed spaces before your def. def are hierarchically under classes, so it should be: import datetime from django.db import models from django.utils import timezone # Create your models here. class Poll(models.Model): questio

Re: __unicode__() addition not working in basic poll application.

2014-03-27 Thread Steve Evans
Hi I am having the same issue: I am using Python 2.7, and Django 1.6. Here is my code for models.py: import datetime from django.db import models from django.utils import timezone # Create your models here. class Poll(models.Model): question = models.CharField(max_length=200) def __unicode_

Re: __unicode__() addition not working in basic poll application.

2014-01-12 Thread shmengie
trojactory has the right idea. __unicode__ has two underscores on either side of _ _ unicode _ _ If you don't spell __unicode__ with two underscores on both sides, you are not overriding the default method __unicode__ You are getting the default output for __unicode__ instead of the expected.

Re: __unicode__() addition not working in basic poll application.

2014-01-11 Thread Juan Hu
As I mentioned, I tried this but it doesn't work for me. Is this the python unicode problem? I tried unicode(Poll.objects.all()) and it returns the same On Saturday, 11 January 2014 12:38:16 UTC-8, Kai Ren wrote: > > Just type exit() > then re-enter the shell, it will work. > > On Monday, May 16,

Re: __unicode__() addition not working in basic poll application.

2014-01-11 Thread Juan Hu
No, just single underscore On Saturday, 11 January 2014 06:25:20 UTC-8, trojactory wrote: > > Juan, > > Are you entering double underscores like '__unicode__'? > > Cheers, > Arun > > On Saturday, January 11, 2014 5:14:01 AM UTC+5:30, Juan Hu wrote: >> >> I have same problem with Django 1.6.1 and P

Re: __unicode__() addition not working in basic poll application.

2014-01-11 Thread Kai Ren
Just type exit() then re-enter the shell, it will work. On Monday, May 16, 2011 7:32:41 AM UTC-5, maaz muqri wrote: > > Hi, > > class Poll(models.Model): > # ... > def __unicode__(self): > return self.question > > class Choice(models.Model

Re: __unicode__() addition not working in basic poll application.

2014-01-11 Thread trojactory
Juan, Are you entering double underscores like '__unicode__'? Cheers, Arun On Saturday, January 11, 2014 5:14:01 AM UTC+5:30, Juan Hu wrote: > > I have same problem with Django 1.6.1 and Python 2.7.5. I tried to restart > interactive interpreter by exit() but it still doesn't work :( > Followin

Re: __unicode__() addition not working in basic poll application.

2014-01-10 Thread Juan Hu
I have same problem with Django 1.6.1 and Python 2.7.5. I tried to restart interactive interpreter by exit() but it still doesn't work :( Following the tutorial, for Python3 we use _str_ but I am using Python 2.7.5 so I use _unicode_. Can anyone help to point out the problem and solution? Thanks!

Re: __unicode__() addition not working in basic poll application.

2013-10-08 Thread Nigel Legg
show us your code, and someone might show you where it is wrong, but the tutorial is pretty clear on what you have to do. Cheers, Nigel 07914 740972 On 8 October 2013 22:42, Brachamul wrote: > Could someone post what the entire "models.py" file should look like at > this point? > I don't thin

Re: __unicode__() addition not working in basic poll application.

2013-10-08 Thread Brachamul
Could someone post what the entire "models.py" file should look like at this point? I don't think I have indendation problems, but I'm new to both Python & Django, so I can't be sure. Using Python 2.7.5 and Django 1.4. -- You received this message because you are subscribed to the Google Groups

Re: __unicode__() addition not working in basic poll application.

2013-08-12 Thread Waqas Javed
I was having the same problem my django version was 1.3.1 and python 2.7. There was indentation problem with my code after correcting it my problem was solved. On Tuesday, June 14, 2011 11:01:54 PM UTC+5, Kyle Latham wrote: > > Hello, > > I am having the same problem while working through the t

Re: __unicode__() addition not working in basic poll application.

2013-06-20 Thread Manjunath Shivanna
Just restart the python interactive Shell... that should solve your problem Regards, Manju On Monday, May 16, 2011 5:32:41 AM UTC-7, maaz muqri wrote: > > Hi, > > class Poll(models.Model): > # ... > def __unicode__(self): > return self.que

Re: __unicode__() addition not working in basic poll application.

2012-11-14 Thread Russell Keith-Magee
On Wed, Nov 14, 2012 at 5:13 PM, Daniel Roseman wrote: > On Tuesday, 13 November 2012 20:10:38 UTC, Colin Keenan wrote: > >> 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, b

Re: __unicode__() addition not working in basic poll application.

2012-11-14 Thread Daniel Roseman
On Tuesday, 13 November 2012 20:10:38 UTC, Colin Keenan wrote: > 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 > che

Re: __unicode__() addition not working in basic poll application.

2012-11-13 Thread Colin Keenan
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

Re: __unicode__() addition not working in basic poll application.

2012-11-13 Thread Colin Keenan
Thanks for the advice. It's true that I'm just learning django, and because I wanted to use python3, I installed via the most up-to-date development source code. My experience with development versions of stuff has actually been better than the fully supported versions of the same product for s

Re: __unicode__() addition not working in basic poll application.

2012-11-13 Thread Tom Evans
On Tue, Nov 13, 2012 at 8:35 AM, Colin Keenan wrote: > I found out the reason `__str__()` worked for me but `__unicode__()` didn't. > It's because python3 already uses unicode in the `__str__` method, so if > using python3, don't use `__unicode__`. You should be fore-warned that Django does not o

Re: __unicode__() addition not working in basic poll application.

2012-11-13 Thread Colin Keenan
As of the moment I'm writing this post, my first post hasn't shown up yet. I'm having the same problem. After posting my situation, I decided to also write a __str__(self) method. That worked! But, the tutorial clearly states that we should not be doing the usual __str__, and instead doing __un

Re: __unicode__() addition not working in basic poll application.

2012-11-13 Thread Colin Keenan
I found out the reason `__str__()` worked for me but `__unicode__()` didn't. It's because python3 already uses unicode in the `__str__` method, so if using python3, don't use `__unicode__`. On Monday, May 16, 2011 7:32:41 AM UTC-5, maaz muqri wrote: > > Hi, > ___

Re: __unicode__() addition not working in basic poll application.

2012-11-13 Thread Colin Keenan
I also found this by searching from google. I am also having the exact same problem. I know python well enough not to make a "spacing" error. The people that were having this problem over a year ago seem to have never gotten the solution to their problem. I installed everything myself from dev

Re: __unicode__() addition not working in basic poll application.

2012-10-19 Thread Sandi Andrian
Restart your interactive shell by *exit() *first then *python manage.py shell*. It's works for me -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/AYBiKDc7a

Re: __unicode__() addition not working in basic poll application.

2011-07-19 Thread Spartan
Hello, I just started using django two days ago. I tried your method and >>> p=Poll.objects.all()[0] >>> p #results in >>> type(p) #results in >>> dir(p) #gives an error ['DoesNotExist', 'MultipleObjectsReturned', '__class__', '__delattr__' '__dict__', '__doc__', '__eq__', '__format__', '__geta

Re: __unicode__() addition not working in basic poll application.

2011-06-14 Thread Micky Hulse
On Tue, Jun 14, 2011 at 11:01 AM, Kyle Latham wrote: Poll.objects.all() > [] 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 onc

Re: __unicode__() addition not working in basic poll application.

2011-06-14 Thread Kyle Latham
Hello, I am having the same problem while working through the tutorial. have searched these forums and tried everything that was recommended. My spacing is good also - I checked that. I am still getting the same output: >>> Poll.objects.all() [] Any ideas on how to fix my issue? On Jun 5, 11:2

Re: __unicode__() addition not working in basic poll application.

2011-06-05 Thread EPS
Hi, i found this post when try to solve same problem: my trouble was a "spaces" in models.py. in your first message it seems to be ok, but you must really check spaces in your class describe. http://mail.python.org/pipermail/tutor/2007-January/051903.html On May 17, 4:59 pm, maaz muqri wrote: > i

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread Roman Klesel
hmm... strange... 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__

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread maaz muqri
im just getting "Poll object" as output On May 17, 1:14 pm, Roman Klesel wrote: > 2011/5/16 maaz muqri : > > > I am getting this > > Poll.objects.all() > > [] > > What do you get when you do: > > print unicode(Poll.objects.all()[0]) > > ? > > Regards >  Roman -- You received this message be

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread Roman Klesel
2011/5/16 maaz muqri : > I am getting this > Poll.objects.all() > [] What do you get when you do: print unicode(Poll.objects.all()[0]) ? Regards Roman -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to

Re: __unicode__() addition not working in basic poll application.

2011-05-17 Thread maaz muqri
but still I am getting same problem On May 16, 6:58 pm, AJ wrote: > I think you are getting the poll object back. You need to specify the method > for your model class(es) > > def __unicode__(self): >         return "%s %s %s" % (self.poll_name) > > > > > > > > > > On Mon, May 16, 2011 at 8:32 AM

Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread AJ
Sorry about that. It is indeed not right. I will take care of this from next time onwards. On Mon, May 16, 2011 at 11:45 AM, Fabian Ezequiel Gallina < galli...@gmail.com> wrote: > 2011/5/16 AJ : > > I think you are getting the poll object back. You need to specify the > method > > for your model

Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread Fabian Ezequiel Gallina
2011/5/16 AJ : > I think you are getting the poll object back. You need to specify the method > for your model class(es) > > def __unicode__(self): > > return "%s %s %s" % (self.poll_name) > > That is wrong, you have a placeholder for three args and just pass one to the string formatting.

Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread Gabe
Can it be necessary to recreate a model? On 16 Maj, 16:32, momo2k wrote: > Did you restart the interpreter after adding the code? -- 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.co

Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread momo2k
Did you restart the interpreter after adding the code? -- 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...@go

Re: __unicode__() addition not working in basic poll application.

2011-05-16 Thread AJ
I think you are getting the poll object back. You need to specify the method for your model class(es) def __unicode__(self): return "%s %s %s" % (self.poll_name) On Mon, May 16, 2011 at 8:32 AM, maaz muqri wrote: > Hi, > > class Poll(models.Model):