Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
e2b18081
Kaydet (Commit)
e2b18081
authored
Kas 22, 2012
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19335 - Typo and cleanups in docs/topics/class-based-views/index.txt
üst
978d4476
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
index.txt
docs/topics/class-based-views/index.txt
+11
-9
No files found.
docs/topics/class-based-views/index.txt
Dosyayı görüntüle @
e2b18081
...
...
@@ -24,9 +24,9 @@ Basic examples
Django provides base view classes which will suit a wide range of applications.
All views inherit from the :class:`~django.views.generic.base.View` class, which
handles linking the view in to the URLs, HTTP method dispatching and other
simple features. :class:`~django.views.generic.base.RedirectView` is for a
simple HTTP
redirect, and :class:`~django.views.generic.base.TemplateView` extends the base class
to make it also render a template.
simple features. :class:`~django.views.generic.base.RedirectView` is for a
simple HTTP redirect, and :class:`~django.views.generic.base.TemplateView`
extends the base class
to make it also render a template.
Simple usage in your URLconf
...
...
@@ -34,7 +34,8 @@ Simple usage in your URLconf
The simplest way to use generic views is to create them directly in your
URLconf. If you're only changing a few simple attributes on a class-based view,
you can simply pass them into the ``as_view`` method call itself::
you can simply pass them into the
:meth:`~django.views.generic.base.View.as_view` method call itself::
from django.conf.urls import patterns, url, include
from django.views.generic import TemplateView
...
...
@@ -43,9 +44,10 @@ you can simply pass them into the ``as_view`` method call itself::
(r'^about/', TemplateView.as_view(template_name="about.html")),
)
Any arguments given will override the ``template_name`` on the
A similar overriding pattern can be used for the ``url`` attribute on
:class:`~django.views.generic.base.RedirectView`.
Any arguments passed to :meth:`~django.views.generic.base.View.as_view` will
override attributes set on the class. In this example, we set ``template_name``
on the ``TemplateView``. A similar overriding pattern can be used for the
``url`` attribute on :class:`~django.views.generic.base.RedirectView`.
Subclassing generic views
...
...
@@ -67,8 +69,8 @@ and override the template name::
Then we just need to add this new view into our URLconf.
`~django.views.generic.base.TemplateView` is a class, not a function, so we
point the URL to the
``as_view`` class method instead, which provides a
function-like entry to class-based views::
point the URL to the
:meth:`~django.views.generic.base.View.as_view` class
method instead, which provides a
function-like entry to class-based views::
# urls.py
from django.conf.urls import patterns, url, include
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment