diff options
| author | Tim Graham <timograham@gmail.com> | 2012-09-19 16:36:34 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2012-09-19 18:01:24 -0400 |
| commit | 57cdbf3bf8e80eb5c265852bfa5eb4b3f514809e (patch) | |
| tree | 3712b73b04804fcd1d91951fba2c669d469aedff | |
| parent | 3a64adef611ba152eb96d77645480e1953825803 (diff) | |
[1.4.X] Fixed #14829 - Added references to CBVs in the URLConf docs; thanks Andrew Willey for the suggestion.
Backport of acd74ffa35 from master
| -rw-r--r-- | docs/topics/http/urls.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt index 1c2849d477..30ae208313 100644 --- a/docs/topics/http/urls.txt +++ b/docs/topics/http/urls.txt @@ -55,7 +55,8 @@ algorithm the system follows to determine which Python code to execute: one that matches the requested URL. 4. Once one of the regexes matches, Django imports and calls the given - view, which is a simple Python function. The view gets passed an + view, which is a simple Python function (or a :doc:`class based view + </topics/class-based-views/index>`). The view gets passed an :class:`~django.http.HttpRequest` as its first argument and any values captured in the regex as remaining arguments. @@ -673,6 +674,15 @@ The style you use is up to you. Note that if you use this technique -- passing objects rather than strings -- the view prefix (as explained in "The view prefix" above) will have no effect. +Note that :doc:`class based views</topics/class-based-views/index>` must be +imported:: + + from mysite.views import ClassBasedView + + urlpatterns = patterns('', + (r'^myview/$', ClassBasedView.as_view()), + ) + .. _naming-url-patterns: Naming URL patterns |
