kopia lustrzana https://github.com/wagtail/bakerydemo
Apply RevisionMixin to BreadType model
rodzic
172cdd9e5f
commit
423fe9195f
|
@ -0,0 +1,28 @@
|
||||||
|
# Generated by Django 4.1.2 on 2022-10-20 13:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("wagtailcore", "0077_alter_revision_user"),
|
||||||
|
("breads", "0004_use_json_field_for_body_streamfield"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="breadtype",
|
||||||
|
name="latest_revision",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
editable=False,
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
related_name="+",
|
||||||
|
to="wagtailcore.revision",
|
||||||
|
verbose_name="latest revision",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -4,7 +4,7 @@ from django.db import models
|
||||||
from modelcluster.fields import ParentalManyToManyField
|
from modelcluster.fields import ParentalManyToManyField
|
||||||
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
|
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
|
||||||
from wagtail.fields import StreamField
|
from wagtail.fields import StreamField
|
||||||
from wagtail.models import Page
|
from wagtail.models import Page, RevisionMixin
|
||||||
from wagtail.search import index
|
from wagtail.search import index
|
||||||
from wagtail.snippets.models import register_snippet
|
from wagtail.snippets.models import register_snippet
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class BreadIngredient(models.Model):
|
||||||
|
|
||||||
|
|
||||||
@register_snippet
|
@register_snippet
|
||||||
class BreadType(models.Model):
|
class BreadType(RevisionMixin, models.Model):
|
||||||
"""
|
"""
|
||||||
A Django model to define the bread type
|
A Django model to define the bread type
|
||||||
It uses the `@register_snippet` decorator to allow it to be accessible
|
It uses the `@register_snippet` decorator to allow it to be accessible
|
||||||
|
|
Ładowanie…
Reference in New Issue