-1
from django.db import models
from mezzanine.pages.models import Page
# The members of Page will be inherited by the Author model, such
# as title, slug, etc. For authors we can use the title field to
# store the author's name. For our model definition, we just add
# any extra fields that aren't part of the Page model, in this
# case, date of birth.
class Author(Page):
dob = models.DateField("Date of birth")
class Book(models.Model):
author = models.ForeignKey("Author")
cover = models.ImageField(upload_to="authors")
因此,Book也繼承了Page的屬性嗎?那麼這意味着頁面的任何屬性或方法都可以通過上面的代碼訪問?Python Django夾層模型導入