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
473ab461
Kaydet (Commit)
473ab461
authored
Agu 17, 2017
tarafından
Jeremy Satterfield
Kaydeden (comit)
Tim Graham
Eyl 02, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28332 -- Fixed diamond inheritence example in docs.
üst
60443e84
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
models.txt
docs/topics/db/models.txt
+6
-1
No files found.
docs/topics/db/models.txt
Dosyayı görüntüle @
473ab461
...
...
@@ -1346,15 +1346,20 @@ use an explicit :class:`~django.db.models.AutoField` in the base models::
class BookReview(Book, Article):
pass
Or use a common ancestor to hold the :class:`~django.db.models.AutoField`::
Or use a common ancestor to hold the :class:`~django.db.models.AutoField`. This
requires using an explicit :class:`~django.db.models.OneToOneField` from each
parent model to the common ancestor to avoid a clash between the fields that
are automatically generated and inherited by the child::
class Piece(models.Model):
pass
class Article(Piece):
article_piece = models.OneToOneField(Piece, on_delete=models.CASCADE, parent_link=True)
...
class Book(Piece):
book_piece = models.OneToOneField(Piece, on_delete=models.CASCADE, parent_link=True)
...
class BookReview(Book, Article):
...
...
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