Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#19403 closed Uncategorized (invalid)

timezone missing error

Reported by: anonymous Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When I did this part of the turorial:

Just for good measure, let's also include the was_published_recently custom method from Tutorial 1:

class PollAdmin(admin.ModelAdmin):

# ...
list_display = ('question', 'pub_date', 'was_published_recently')

Adding 'was_published_recently' to list_display in would cause an error: "Global name timezone not defined"

I added this to the top of to fix it:
from django.utils import timezone

to get rid of the error

Change History (2)

comment:1 Changed 5 years ago by Tim Graham

Resolution: invalid
Status: newclosed

You must have missed the part in tutorial 1 where it instructs to add that import.

comment:2 Changed 5 years ago by anonymous

See about this error in version 1.5-alpha-1

Note: See TracTickets for help on using tickets.
Back to Top