Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#19937 closed Bug (fixed)

Small bug in a documentation code example (Introduction to Class-based views)

Reported by: anonymous Owned by: nobody
Component: Documentation Version: dev
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

The page at https://docs.djangoproject.com/en/dev/topics/class-based-views/intro/ says:

The first is the standard Python way of subclassing and overriding attributes and
methods in the subclass. So that if your parent class had an attribute greeting
like this:

from django.http import HttpResponse
from django.views.base import View

class GreetingView(View):

greeting = "Good Day"

def get(self, request):

return HttpResponse(self.greeting)



You can override that in a subclass:

class MorningGreetingView(MyView):

greeting = "Morning to ya"

The superclass of the last definition is wrong. Correct definition would be:

class MorningGreetingView(GreetingView):
    greeting = "Morning to ya"

Change History (2)

comment:1 by Tim Graham <timograham@…>, 12 years ago

Resolution: fixed
Status: newclosed

In d009ffe436410f6935798d910b0e489d53411dfa:

Fixed #19937 - Typo in class-based views intro.

comment:2 by Tim Graham <timograham@…>, 12 years ago

In ed381bd922faa1379f1021f2a3dd57fe8a5163b2:

[1.5.x] Fixed #19937 - Typo in class-based views intro.

Backport of d009ffe436 from master

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