Repository: wagtail/wagtail
File: wagtail/models/__init__.py (Python)

Code before:
        max_length=255,
        verbose_name=_("object id"),
    )
    submitted_for_moderation = models.BooleanField(
        verbose_name=_("submitted for moderation"), default=False, db_index=True
    )
    created_at = models.DateTimeField(db_index=True, verbose_name=_("created at"))
    user = models.ForeignKey(
        settings.AUTH_USER_MODEL,
        verbose_name=_("user"),
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    content = models.JSONField(
        verbose_name=_("content JSON"), encoder=DjangoJSONEncoder
    )
    approved_go_live_at = models.DateTimeField(
        verbose_name=_("approved go live at"), null=True, blank=True, db_index=True
    )

    objects = models.Manager()
    page_revisions = PageRevisionsManager()
    submitted_revisions = SubmittedRevisionsManager()

    content_object = GenericForeignKey(
        "content_type", "object_id", for_concrete_model=False
    )

    @property
    def page(self):
        warnings.warn(
            "Revisions should access .content_object instead of .page "
            "to retrieve the object.",
            category=RemovedInWagtail50Warning,
            stacklevel=2,
        )
        return self.content_object

    @property
    def page_id(self):
        warnings.warn(
            "Revisions should access .object_id instead of .page_id "
            "to retrieve the object's primary key. For page revisions, "
            "you may need to cast the object_id to integer first.",
            category=RemovedInWagtail50Warning,
            stacklevel=2,
        )
        return int(self.object_id)

    def save(self, user=None, *args, **kwargs):

Review comment (suggestion):
This means that the `content_object` is always an instance of the specific page type. I don't think there's a downside to this as all tests seem to pass (after some minor adjustments in this PR) and we even considered enforcing that `save_revision()` is called with a specific page object (#8573).

Code after:
    )
    submitted_for_moderation = models.BooleanField(
        verbose_name=_("submitted for moderation"), default=False, db_index=True
    )
    created_at = models.DateTimeField(db_index=True, verbose_name=_("created at"))
    user = models.ForeignKey(
        settings.AUTH_USER_MODEL,
        verbose_name=_("user"),
        null=True,
        blank=True,
        on_delete=models.SET_NULL,
    )
    content = models.JSONField(
        verbose_name=_("content JSON"), encoder=DjangoJSONEncoder
    )
    approved_go_live_at = models.DateTimeField(
        verbose_name=_("approved go live at"), null=True, blank=True, db_index=True
    )

    objects = RevisionsManager()
    page_revisions = PageRevisionsManager()
    submitted_revisions = SubmittedRevisionsManager()

    content_object = GenericForeignKey(
        "content_type", "object_id", for_concrete_model=False
    )

    @cached_property
    def base_content_object(self):
        return self.base_content_type.get_object_for_this_type(pk=self.object_id)

    @property
    def page(self):
        warnings.warn(
            "Revisions should access .content_object instead of .page "
            "to retrieve the object.",
            category=RemovedInWagtail50Warning,
            stacklevel=2,
        )
        return self.content_object

    @property
    def page_id(self):
        warnings.warn(
            "Revisions should access .object_id instead of .page_id "
            "to retrieve the object's primary key. For page revisions, "
            "you may need to cast the object_id to integer first.",
            category=RemovedInWagtail50Warning,
            stacklevel=2,
        )
        return int(self.object_id)