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 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__(self):
> return self.question
>
> pub_date = models.DateTimeField('date published')
> def was_published_recently(self):
> return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
> def __unicode__(self):
> return self.choice_text
>
>
> I have restarted the shell and this is what I get as a result:
>
> 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()
>
> [, ]
>
> >>> 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()
>
> [, ]
>
> >>>
> Any help would be great...
>
> Cheers,
> Steve
>
>
>
> On Sunday, 12 January 2014 14:34:22 UTC, shmengie wrote:
>>
>> 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.
>>
>  --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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.
>



-- 
Matheus Henrique Oliveira

Twitter: @matheusho42 
+55 16 9-8170.0339

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CABd-j%3DS6ib%2B-%2By3VqpNsd3-HZcmcJkDHRp9OMRrYPcHJ6K1wBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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 Thursday, 27 March 2014 10:53:29 UTC, Shai Efrati wrote:
>
> 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):
> question = models.CharField(max_length=200)
> def __unicode__(self):
> return self.question
> pub_date = models.DateTimeField('date published')
> def was_published_recently(self):
>   return self.pub_date >= timezone.now() - 
> datetime.timedelta(days=1)
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
> def __unicode__(self):
>  return self.choice_text
>
>
> Good luck!
>
>
> Shai.
>
>
> On Thu, Mar 27, 2014 at 12:06 PM, Steve Evans <00se...@gmail.com
> > wrote:
>
>> 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__(self):
>> return self.question
>>
>> pub_date = models.DateTimeField('date published')
>> def was_published_recently(self):
>> return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
>>
>> class Choice(models.Model):
>> poll = models.ForeignKey(Poll)
>> choice_text = models.CharField(max_length=200)
>> votes = models.IntegerField(default=0)
>> def __unicode__(self):
>> return self.choice_text
>>
>>
>> I have restarted the shell and this is what I get as a result:
>>
>> 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()
>>
>> [, ]
>>
>> >>> 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()
>>
>> [, ]
>>
>> >>> 
>> Any help would be great...
>>
>> Cheers,
>> Steve
>>
>>
>>
>> On Sunday, 12 January 2014 14:34:22 UTC, shmengie wrote:
>>>
>>>  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.
>>>
>>  -- 
>> 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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/a2d77f15-84ce-47cb-9b23-5dbc1827e65b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


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):
question = models.CharField(max_length=200)
def __unicode__(self):
return self.question
pub_date = models.DateTimeField('date published')
def was_published_recently(self):
  return self.pub_date >= timezone.now() -
datetime.timedelta(days=1)

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __unicode__(self):
 return self.choice_text


Good luck!


Shai.


On Thu, Mar 27, 2014 at 12:06 PM, Steve Evans <00sev...@gmail.com> wrote:

> 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__(self):
> return self.question
>
> pub_date = models.DateTimeField('date published')
> def was_published_recently(self):
> return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
>
> class Choice(models.Model):
> poll = models.ForeignKey(Poll)
> choice_text = models.CharField(max_length=200)
> votes = models.IntegerField(default=0)
> def __unicode__(self):
> return self.choice_text
>
>
> I have restarted the shell and this is what I get as a result:
>
> 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()
>
> [, ]
>
> >>> 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()
>
> [, ]
>
> >>>
> Any help would be great...
>
> Cheers,
> Steve
>
>
>
> On Sunday, 12 January 2014 14:34:22 UTC, shmengie wrote:
>>
>>  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.
>>
>  --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CALr%3D9OVE2q30D8SWUdgfV6YFWPKqgLKRTY9m29c-x06-j9BFaw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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__(self):
return self.question

pub_date = models.DateTimeField('date published')
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)

class Choice(models.Model):
poll = models.ForeignKey(Poll)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __unicode__(self):
return self.choice_text


I have restarted the shell and this is what I get as a result:

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()

[, ]

>>> 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()

[, ]

>>> 
Any help would be great...

Cheers,
Steve



On Sunday, 12 January 2014 14:34:22 UTC, shmengie wrote:
>
> 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.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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.


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.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/b566b0d6-6db0-4258-8038-83a945029c5d%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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, 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): 
>> # ... 
>> def __unicode__(self): 
>> return self.choice 
>>  
>>
>>
>> after adding the above code also I am not able to retrieve the 
>> question by the command: 
>>
>> I am getting this 
>>
>> >>>Poll.objects.all() 
>> [] 
>>
>>
>> instead of this 
>>
>> >>>Poll.objects.all() 
>> []
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/d9adf65d-3f61-4fbd-8084-5785b9aadf0c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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 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!
>>
>> On Monday, 16 May 2011 05:32:41 UTC-7, maaz muqri wrote:
>>>
>>> Hi, 
>>>  
>>> class Poll(models.Model): 
>>> # ... 
>>> def __unicode__(self): 
>>> return self.question 
>>>
>>> class Choice(models.Model): 
>>> # ... 
>>> def __unicode__(self): 
>>> return self.choice 
>>>  
>>>
>>>
>>> after adding the above code also I am not able to retrieve the 
>>> question by the command: 
>>>
>>> I am getting this 
>>>
>>> >>>Poll.objects.all() 
>>> [] 
>>>
>>>
>>> instead of this 
>>>
>>> >>>Poll.objects.all() 
>>> []
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/e57019b4-572d-4bdb-af94-b9b4f010d7b1%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/c0518a71-1de5-45af-b96c-d04718547c57%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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 :(
> 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!
>
> On Monday, 16 May 2011 05:32:41 UTC-7, maaz muqri wrote:
>>
>> Hi, 
>>  
>> class Poll(models.Model): 
>> # ... 
>> def __unicode__(self): 
>> return self.question 
>>
>> class Choice(models.Model): 
>> # ... 
>> def __unicode__(self): 
>> return self.choice 
>>  
>>
>>
>> after adding the above code also I am not able to retrieve the 
>> question by the command: 
>>
>> I am getting this 
>>
>> >>>Poll.objects.all() 
>> [] 
>>
>>
>> instead of this 
>>
>> >>>Poll.objects.all() 
>> []
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/bdbe750f-7524-481f-aec7-11d5b37d61f6%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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!

On Monday, 16 May 2011 05:32:41 UTC-7, maaz muqri wrote:
>
> Hi, 
>  
> class Poll(models.Model): 
> # ... 
> def __unicode__(self): 
> return self.question 
>
> class Choice(models.Model): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/aa10f401-8dc1-405d-97ce-eef185903d3b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


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 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
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CADeX7vzq-dPF8n_%2B%3Dz8ngndy_LcbGLiapd7ePn%2BT7Z76ng2sQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


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 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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.


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 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:20 am, EPS  wrote: 
> > 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: 
> > 
> > 
> > 
> > > im just getting "Pollobject" 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- Hide quoted text - 
> > 
> > - Show quoted text -

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




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.question 
>
> class Choice(models.Model): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.




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, 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.
>>
>>
> Django 1.5 isn't even released yet. I've no idea how you've got onto "1.6
> alpha", but I doubt it will be released any time soon - it's probably at
> least 9 months away. You should stick to the released versions rather than
> running from trunk, and that means Python 2 for now.
>

Filling in the blanks here -- If you download Django's trunk branch, it
currently reports as 1.6 alpha. When we cut the 1.5 alpha, we created a
separate branch for 1.5 development, so that trunk can remain in a live
"commit anything" state, rather than our historical "trunk feature freeze"
state.

So, in theory, trunk can currently contain features that won't be included
in 1.5; however, in practice, the core team is focussing primarily on the
1.5 release branch, in preparation for the 1.5 beta and final releases.

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.



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 
> checking out new versions as I learn so by the time 1.6 is really out, I'll 
> be all set.
>
>
Django 1.5 isn't even released yet. I've no idea how you've got onto "1.6 
alpha", but I doubt it will be released any time soon - it's probably at 
least 9 months away. You should stick to the released versions rather than 
running from trunk, and that means Python 2 for now.
--
DR.

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



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 
be all set.

On Tuesday, November 13, 2012 10:10:27 AM UTC-6, Tom Evans wrote:
>
> 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 officially support Python 
> 3. 
>
> https://docs.djangoproject.com/en/1.4/releases/1.4/#python-compatibility 
>
> If you are using the trunk or 1.5 version of django, then that has 
> experimental support for python 3. 
>
>
> https://docs.djangoproject.com/en/dev/faq/install/#can-i-use-django-with-python-3
>  
>
> If you are trying to learn how to use django, I would strongly 
> recommend against using an in development version of django, or using 
> experimental support for python 3, since these can introduce strange 
> side effects like the one you've noticed that are not fully 
> documented. OTOH, if you know django and want to make the next release 
> even better, or improve on that experimental support, dive right in. 
>
> Cheers 
>
> Tom 
>

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



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 some 
reason. So, I'll be continuing on this path. It's strange that people were 
experiencing this error over a year ago and didn't mention if they were 
using python3. Anyone searching on this error in the future will be glad to 
see the correct answer here if they are using python3.

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): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

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



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 officially support Python 3.

https://docs.djangoproject.com/en/1.4/releases/1.4/#python-compatibility

If you are using the trunk or 1.5 version of django, then that has
experimental support for python 3.

https://docs.djangoproject.com/en/dev/faq/install/#can-i-use-django-with-python-3

If you are trying to learn how to use django, I would strongly
recommend against using an in development version of django, or using
experimental support for python 3, since these can introduce strange
side effects like the one you've noticed that are not fully
documented. OTOH, if you know django and want to make the next release
even better, or improve on that experimental support, dive right in.

Cheers

Tom

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



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 
__unicode__. So, what's wrong with my django install?

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): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

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



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, 
>  
> class Poll(models.Model): 
> # ... 
> def __unicode__(self): 
> return self.question 
>
> class Choice(models.Model): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

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



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 development source code or most recent 
source code including PostgreSQL and all the dependencies for everything 
from source as well. I did everything with python3 instead of python. This 
is in Ubuntu 12.10.

Does anyone have any other ideas?

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): 
> # ... 
> def __unicode__(self): 
> return self.choice 
>  
>
>
> after adding the above code also I am not able to retrieve the 
> question by the command: 
>
> I am getting this 
>
> >>>Poll.objects.all() 
> [] 
>
>
> instead of this 
>
> >>>Poll.objects.all() 
> []

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



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



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__', '__getattribute__',
'_hash__', '__init__', '__metaclass__', '__module__', '__ne__',
'__new__, '__reduce__', '__reduce_ex__', '__repr__', '__setattr__',
'__sizeof_', '__str__', '__subclasshook__', '__weakref__',
'_base_manager', '_deault_manager', '_deferred', '_get_FIELD_display',
'_get_next_or_previos_by_FIELD', '_get_next_or_previous_in_order',
'_get_pk_val', '_get_unque_checks', '_meta', '_perform_date_checks',
'_perform_unique_checks' '_set_pk_val', '_state', '_unicode_',
'choice_set', 'clean', 'clean_felds', 'date_error_message', 'delete',
'full_clean', 'get_next_by_pub_ate', 'get_previous_by_pub_date', 'id',
'objects', 'pk', 'prepare_dataase_save', 'pub_date', 'question',
'save', 'save_base', 'serializable_alue', 'unique_error_message',
'validate_unique']
-

>>> p =Poll.objects.all()
>>> for x in p:
 . . .print x (indent this line four spaces, hit return key once)
 . . . (hit return key again)
#results in
 Poll object

---

help 0_0


On Jun 14, 9:55 pm, Micky Hulse  wrote:
> 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 once)
> . . . (hit return key again)
>
> Does any of that help?
>
> Good luck!
>
> Cheers,
> Micky

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



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 once)
. . . (hit return key again)

Does any of that help?

Good luck!

Cheers,
Micky

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



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:20 am, EPS  wrote:
> 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:
>
>
>
> > im just getting "Pollobject" 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- Hide quoted text -
>
> - Show quoted text -

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



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



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__(self):
... return "str"
...
>>> o=TestClass()
>>> o
buh
>>> print o
str
>>> print unicode(o)
unicode
>>>


2011/5/17 maaz muqri :
> im just getting "Poll object" as output

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



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



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



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, maaz muqri  wrote:
> > Hi,
> > 
> > class Poll(models.Model):
> >    # ...
> >    def __unicode__(self):
> >        return self.question
>
> > class Choice(models.Model):
> >    # ...
> >    def __unicode__(self):
> >        return self.choice
> > 
>
> > after adding the above code also I am not able to retrieve the
> > question by the command:
>
> > I am getting this
>
> > >>>Poll.objects.all()
> > []
>
> > instead of this
>
> > >>>Poll.objects.all()
> > []
>
> > --
> > 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.
>
> --
> AJ

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



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


-- 
AJ

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



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



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



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



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):
># ...
>def __unicode__(self):
>return self.question
>
> class Choice(models.Model):
># ...
>def __unicode__(self):
>return self.choice
> 
>
>
> after adding the above code also I am not able to retrieve the
> question by the command:
>
> I am getting this
>
> >>>Poll.objects.all()
> []
>
>
> instead of this
>
> >>>Poll.objects.all()
> []
>
> --
> 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.
>
>


-- 
AJ

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



__unicode__() addition not working in basic poll application.

2011-05-16 Thread maaz muqri
Hi,

class Poll(models.Model):
# ...
def __unicode__(self):
return self.question

class Choice(models.Model):
# ...
def __unicode__(self):
return self.choice



after adding the above code also I am not able to retrieve the
question by the command:

I am getting this

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


instead of this

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

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