Make the dummy Admin model a managed model

Fixes #6810. As per https://code.djangoproject.com/ticket/13816 , unmanaged models are included in dumpdata by design and so unmanaged models without a database table are not valid.
pull/6815/head
Matt Westcott 2021-02-15 15:43:07 +00:00
rodzic afc3349c94
commit 0a8ab74d70
4 zmienionych plików z 27 dodań i 2 usunięć

Wyświetl plik

@ -16,6 +16,7 @@ Changelog
* Fix: Ensure aliases are published when the source page is published (Karl Hobley)
* Fix: Prevent error when saving embeds that do not include a thumbnail URL (Cynthia Kiser)
* Fix: Prevent failure when running `manage.py dumpdata` with no arguments (Matt Westcott)
2.12 (02.02.2021)

Wyświetl plik

@ -15,3 +15,4 @@ Bug fixes
* Ensure aliases are published when the source page is published (Karl Hobley)
* Prevent error when saving embeds that do not include a thumbnail URL (Cynthia Kiser)
* Prevent failure when running `manage.py dumpdata` with no arguments (Matt Westcott)

Wyświetl plik

@ -0,0 +1,24 @@
# Generated by Django 3.1.5 on 2021-02-15 15:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('wagtailadmin', '0002_admin'),
]
operations = [
migrations.DeleteModel(name='Admin'),
migrations.CreateModel(
name='Admin',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
options={
'permissions': [('access_admin', 'Can access Wagtail admin')],
'default_permissions': [],
},
),
]

Wyświetl plik

@ -13,10 +13,9 @@ from wagtail.core.models import Page
# A dummy model that exists purely to attach the access_admin permission type to, so that it
# doesn't get identified as a stale content type and removed by the remove_stale_contenttypes
# management command. managed = False ensures that this doesn't create a database table.
# management command.
class Admin(Model):
class Meta:
managed = False
default_permissions = [] # don't create the default add / change / delete / view perms
permissions = [
('access_admin', "Can access Wagtail admin"),