Opened 13 years ago
Last modified 13 years ago
#18576 closed Bug
Missing module in import statement — at Version 1
| Reported by: | Owned by: | Claude Paroz | |
|---|---|---|---|
| Component: | Documentation | Version: | 1.4 |
| Severity: | Normal | Keywords: | wrong example |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
A necessary module is not being imported in one of the examples. The example is located at https://docs.djangoproject.com/en/dev/intro/tutorial02/
The example code is as follows:
from django.contrib import admin
from polls.models import Poll
class ChoiceInline(admin.StackedInline):
model = Choice
extra = 3
class PollAdmin(admin.ModelAdmin):
fieldsets = [
(None, {'fields': ['question']}),
('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
]
inlines = [ChoiceInline]
admin.site.register(Poll, PollAdmin)
The second line of the code should also import the `Choice' model as follows:
from polls.models import Poll, Choice
Change History (1)
comment:1 by , 13 years ago
| Description: | modified (diff) |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
| Triage Stage: | Unreviewed → Accepted |
Note:
See TracTickets
for help on using tickets.