Code

Opened 2 years ago

Closed 2 years ago

#18576 closed Bug (fixed)

Missing module in import statement

Reported by: jaaruiz@… Owned by: claudep
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 claudep)

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

Attachments (0)

Change History (2)

comment:1 Changed 2 years ago by claudep

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to claudep
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 2 years ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

In [4c417cc9ebd65595128b81cdddc9ea8293cbcbbe]:

Fixed #18576 -- Added missing import in tutorial02

Thanks jaaruiz at yahoo.com for the report.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.