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
b47552b4
Kaydet (Commit)
b47552b4
authored
Eyl 29, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Made cosmetic cleanups to docs/ref/contrib/contenttypes.txt
üst
8d1a001e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
contenttypes.txt
docs/ref/contrib/contenttypes.txt
+5
-7
No files found.
docs/ref/contrib/contenttypes.txt
Dosyayı görüntüle @
b47552b4
...
...
@@ -98,8 +98,6 @@ created with the following values:
* :attr:`~django.contrib.contenttypes.models.ContentType.model`
will be set to ``'site'``.
.. _the verbose_name attribute: ../model-api/#verbose_name
Methods on ``ContentType`` instances
====================================
...
...
@@ -126,8 +124,7 @@ For example, we could look up the
:class:`~django.contrib.auth.models.User` model::
>>> from django.contrib.contenttypes.models import ContentType
>>> user_type = ContentType.objects.get(app_label="auth", model="user")
>>> user_type
>>> ContentType.objects.get(app_label="auth", model="user")
<ContentType: user>
And then use it to query for a particular
...
...
@@ -224,8 +221,7 @@ want to go to the trouble of obtaining the model's metadata to perform a manual
lookup::
>>> from django.contrib.auth.models import User
>>> user_type = ContentType.objects.get_for_model(User)
>>> user_type
>>> ContentType.objects.get_for_model(User)
<ContentType: user>
.. module:: django.contrib.contenttypes.fields
...
...
@@ -369,6 +365,9 @@ Reverse generic relations
If you know which models you'll be using most often, you can also add
a "reverse" generic relationship to enable an additional API. For example::
from django.db import models
from django.contrib.contenttypes.fields import GenericRelation
class Bookmark(models.Model):
url = models.URLField()
tags = GenericRelation(TaggedItem)
...
...
@@ -464,7 +463,6 @@ to the queryset to ensure the correct content type, but the
into account. For now, if you need aggregates on generic relations, you'll
need to calculate them without using the aggregation API.
.. module:: django.contrib.contenttypes.forms
Generic relation in forms
...
...
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