Sorry about that. Thanks a million for your reply.

On Wednesday, 4 February 2015 17:38:16 UTC, Vijay Khemlani wrote:
>
> The method is called "__str__" (note the double underscore at both ends)
>
> On Wed, Feb 4, 2015 at 2:29 PM, Gavin Patrick McCoy <gavin....@mail.dcu.ie 
> <javascript:>> wrote:
>
>> Hi,
>>
>> Just started learning Django today. I got down to the last grey box of 
>> code on 
>> https://docs.djangoproject.com/en/1.7/intro/tutorial01/#writing-your-first-django-app-part-1
>>  and 
>> when I checked to see of the __str__() addition to models.py worked, it 
>> didn't. I didn't get [<Question: What's up?>], I got [<Question: 
>> Question object>]. I tried creating a new question again and did but now 
>> I get  [<Question: Question object>, <Question: Question object>]. I 
>> then tried 'the three-step guide to making model changes: Change your 
>> models (in models.py). Run python manage.py makemigrations 
>> <https://docs.djangoproject.com/en/1.7/ref/django-admin/#django-admin-makemigrations>
>>  
>> to create migrations for those changes. Run python manage.py migrate 
>> <https://docs.djangoproject.com/en/1.7/ref/django-admin/#django-admin-migrate>
>>  
>> to apply those changes to the database.' I still got  [<Question: 
>> Question object>, <Question: Question object>]. Any ideas? Any help 
>> would be greatly appreciated. 
>>
>> Thanks, Gavin
>>
>> My models.py looks like this: 
>>
>> import datetime
>> from django.db import models
>> from django.utils import timezone
>> # Create your models here.
>> class Question(models.Model):
>>     question_text = models.CharField(max_length=200)
>>     pub_date = models.DateTimeField('date published')
>>     
>>     def _str_(self):
>>         return self.question_text
>>     
>>     def was_published_recently(self):
>>         return self.pub_date >= timezone.now() - 
>> datetime.timedelta(days=1)
>>     
>> class Choice(models.Model):
>>     question = models.ForeignKey(Question)
>>     choice_text = models.CharField(max_length=200)
>>     votes = models.IntegerField(default=0)
>>     def __str(self):
>>         return self.choice_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...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com 
>> <javascript:>.
>> 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/e518a27e-da82-4c93-884f-a7a941d23853%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/e518a27e-da82-4c93-884f-a7a941d23853%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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/6acc2808-2fe9-4643-9d17-c5eaec00e592%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to