Code

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#17510 closed Bug (fixed)

Typo at https://docs.djangoproject.com/en/1.3/topics/class-based-views/#dynamic-filtering

Reported by: andrew@… Owned by: nobody
Component: Documentation Version: master
Severity: Normal Keywords: typo, documentation, web
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

A comma behind the template name in the code blocks

from django.shortcuts import get_object_or_404
from django.views.generic import ListView
from books.models import Book, Publisher

class PublisherBookListView(ListView):

    context_object_name = "book_list"
    template_name = "books/books_by_publisher.html",

    def get_queryset(self):
        publisher = get_object_or_404(Publisher, name__iexact=self.args[0])
        return Book.objects.filter(publisher=publisher)
class PublisherBookListView(ListView):

    context_object_name = "book_list"
    template_name = "books/books_by_publisher.html",

    def get_queryset(self):
        self.publisher = get_object_or_404(Publisher, name__iexact=self.args[0])
        return Book.objects.filter(publisher=self.publisher)

    def get_context_data(self, **kwargs):
        # Call the base implementation first to get a context
        context = super(PublisherBookListView, self).get_context_data(**kwargs)
        # Add in the publisher
        context['publisher'] = self.publisher
        return context

Attachments (1)

patch_17510.diff (965 bytes) - added by noria 2 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 2 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Throws a "TypeError cannot concatenate a 'str' and 'tuple'" or something like that error

Changed 2 years ago by noria

comment:2 Changed 2 years ago by noria

  • Has patch set
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 2 years ago by claudep

  • Triage Stage changed from Accepted to Ready for checkin
  • Type changed from Uncategorized to Bug
  • Version changed from 1.3 to SVN

comment:4 Changed 2 years ago by timo

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

In [17457]:

Fixed #17510 - Typo in docs/topics/class-based-views.txt; thanks andrew and noria.

comment:5 Changed 2 years ago by timo

In [17458]:

[1.3.X] Fixed #17510 - Typo in docs/topics/class-based-views.txt; thanks andrew and noria.

Backport of r17457 from trunk.

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.