#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 |
Description
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 admin.py would cause an error: "Global name timezone not defined"
I added this to the top of models.py to fix it:
from django.utils import timezone
to get rid of the error
Change History (2)
comment:1 by , 13 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
comment:2 by , 13 years ago
See about this error in version 1.5-alpha-1
https://code.djangoproject.com/ticket/19793#ticket
You must have missed the part in tutorial 1 where it instructs to add that import.