Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#12161 closed (fixed)

Error in code example - Generic views (regular expression)

Reported by: infopams Owned by: nobody
Component: Documentation Version: 1.1
Severity: Keywords: regular-expression documentation generic-views
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

(at this page: http://docs.djangoproject.com/en/dev/topics/generic-views/)

This code example is nonfuctional:

from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from mysite.books.views import about_pages

urlpatterns = patterns('',
    ('^about/$', direct_to_template, {
        'template': 'about.html'
    }),
    ('^about/(w+)/$', about_pages),
)

It should be like this:

from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from mysite.books.views import about_pages

urlpatterns = patterns('',
    ('^about/$', direct_to_template, {
        'template': 'about.html'
    }),
    ('^about/(\w+)/$', about_pages),
)

In short: the token (w+) should be replaced for (\w+) in order to have de desired functionality

Attachments (1)

12161.diff (768 bytes) - added by timo 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by mattmcc

  • Component changed from Uncategorized to Documentation
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by timo

comment:2 Changed 5 years ago by timo

  • Has patch set
  • Triage Stage changed from Accepted to Ready for checkin

comment:3 Changed 5 years ago by adrian

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

(In [12182]) Fixed #12161 -- Added escaping of a backslash in two generic-views.txt examples. Thanks, infopams

comment:4 Changed 5 years ago by msaelices

I think second changed line is a raw string, and don't must to be escaped

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