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
494b7986
Kaydet (Commit)
494b7986
authored
Eki 21, 2015
tarafından
Jacek Bzdak
Kaydeden (comit)
Tim Graham
Eki 23, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25397 -- Documented class-based view context variable clash with context processors.
üst
484edc81
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
6 deletions
+29
-6
mixins-single-object.txt
docs/ref/class-based-views/mixins-single-object.txt
+20
-6
api.txt
docs/ref/templates/api.txt
+4
-0
generic-display.txt
docs/topics/class-based-views/generic-display.txt
+5
-0
No files found.
docs/ref/class-based-views/mixins-single-object.txt
Dosyayı görüntüle @
494b7986
...
...
@@ -102,20 +102,34 @@ SingleObjectMixin
Returns context data for displaying the list of objects.
The base implementation of this method requires that the ``object``
The base implementation of this method requires that the ``
self.
object``
attribute be set by the view (even if ``None``). Be sure to do this if
you are using this mixin without one of the built-in views that does so.
It returns a dictionary with these contents:
* ``object``: The object that this view is displaying
(``self.object``).
* ``context_object_name``: ``self.object`` will also be stored under
the name returned by :meth:`get_context_object_name`, which defaults
to the lowercased version of the model name.
.. admonition:: Context variables override values from template context processors
Any variables from :meth:`get_context_data` take precedence over
context variables from :ref:`context processors
<subclassing-context-requestcontext>`. For example, if your view
sets the :attr:`model` attribute to
:class:`~django.contrib.auth.models.User`, the default context
object name of ``user`` would override the ``user`` variable from
the :func:`django.contrib.auth.context_processors.auth` context
processor. Use :meth:`get_context_object_name` to avoid a clash.
.. method:: get_slug_field()
Returns the name of a slug field to be used to look up by slug. By
default this simply returns the value of :attr:`slug_field`.
**Context**
* ``object``: The object that this view is displaying. If
``context_object_name`` is specified, that variable will also be
set in the context, with the same value as ``object``.
SingleObjectTemplateResponseMixin
---------------------------------
...
...
docs/ref/templates/api.txt
Dosyayı görüntüle @
494b7986
...
...
@@ -656,9 +656,13 @@ Context processors
Here's what each of the built-in processors does:
.. currentmodule:: django.contrib.auth.context_processors
django.contrib.auth.context_processors.auth
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. function:: auth
If this processor is enabled, every ``RequestContext`` will contain these
variables:
...
...
docs/topics/class-based-views/generic-display.txt
Dosyayı görüntüle @
494b7986
...
...
@@ -237,6 +237,11 @@ template, but you can override it to send more::
after super if they want to be sure to override all parents. If you're
having trouble, review the method resolution order of your view.
Another consideration is that the context data from class-based generic
views will override data provided by context processors; see
:meth:`~django.views.generic.detail.SingleObjectMixin.get_context_data` for
an example.
.. _generic-views-list-subsets:
Viewing subsets of objects
...
...
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