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
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
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
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
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
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
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
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
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
9 matches
Mail list logo