Get the question that was published this year.
>>> from django.utils import timezone >>> current_year = timezone.now().year >>> Question.objects.get(pub_date__year=current_year) <Question: What's up?> https://stackoverflow.com/questions/65556544/what-is-the-role-of-using-two-dashes-here-year-in-the-example-below-im-new-i January 04, 2021 at 09:03AM
没有评论:
发表评论