Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread Vpeguero
I believe this is how the code is supposed to function. When you visit the index page the list should show the most recently posted/edited poll question. For example: Lets say we have 3 questions Question 1, published - 1 / 19 / 2017 - morning Question 2, published - 1 / 19 / 2017 - ni

Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread DjangoUserDM
Yes, all questions had pub_date set either by a population script or by the admin interface. Anyway, it's working as it should. My problem was that the question I thought was published most recently (i.e., Jan 2017) had in fact been set with a publication date of Jan 2016. Apologies for wasti

Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread jorrit787
Did you set a pub_date on the questions you created? Since the field doesn't have a default value it will remain empty and have no effect on ordering unless you explicitly set pub_date=timezone,now() every time you create a question. On Friday, January 20, 2017 at 2:30:37 PM UTC+1, DjangoUserDM

Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread DjangoUserDM
Here it is: class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def was_published_recently(self): now = timezone.now() return now - datetime.timedelta(days=1) <= self.pub_date <= now def

Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread jorrit787
Can you show your Question model? On Friday, January 20, 2017 at 1:33:33 PM UTC+1, DjangoUserDM wrote: > > No, definitely didn't! > -- 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 i

Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread DjangoUserDM
No, definitely didn't! -- 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-use

Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread DjangoUserDM
No, definitely didn't! On Friday, January 20, 2017 at 10:00:00 AM UTC, jorr...@gmail.com wrote: > > Perhaps you forgot the '-' before pub_date? > > On Thursday, January 19, 2017 at 8:21:32 PM UTC+1, DjangoUserDM wrote: >> >> I have a question about the "Polls" app, as described in the Django >> B

Re: "Polls" app in Django Beginners' Tutorial

2017-01-20 Thread jorrit787
Perhaps you forgot the '-' before pub_date? On Thursday, January 19, 2017 at 8:21:32 PM UTC+1, DjangoUserDM wrote: > > I have a question about the "Polls" app, as described in the Django > Beginners' Tutorial, https://docs.djangoproject.com/en/1.10/intro/. In > tutorial 3, the index view contai

"Polls" app in Django Beginners' Tutorial

2017-01-19 Thread David Manlove
I have a question about the "Polls" app, as described in the Django Beginners' Tutorial, https://docs.djangoproject.com/en/1.10/intro/. In tutorial 3, the index view contains the following code: latest_question_list = Question.objects.order_by('-pub_date')[:5] It is stated that this pr