pull/2079/head
Karl Hobley 2016-01-04 10:32:20 +00:00
rodzic 2045148c0c
commit b375f37d80
9 zmienionych plików z 12 dodań i 114 usunięć

Wyświetl plik

@ -6,7 +6,6 @@ Changelog
* The `Document` model can now be overridden using the new `WAGTAILDOCS_DOCUMENT_MODEL` setting (Alex Gleason)
* Fix: Custom page managers no longer raise an error when used on an abstract model
* Fix: Wagtail's migrations are now all reversible (benjaoming)
1.3 (23.12.2015)
~~~~~~~~~~~~~~~~

Wyświetl plik

@ -93,7 +93,6 @@ Contributors
* Rich Atkinson
* jnns
* Eugene MechanisM
* benjaoming
Translators

Wyświetl plik

@ -23,7 +23,6 @@ Bug fixes
~~~~~~~~~
* Custom page managers no longer raise an error when used on an abstract model
* Wagtail's migrations are now all reversible (benjaoming)
Upgrade considerations

Wyświetl plik

@ -13,20 +13,20 @@ def create_admin_access_permissions(apps, schema_editor):
# Add a fake content type to hang the 'can access Wagtail admin' permission off.
# The fact that this doesn't correspond to an actual defined model shouldn't matter, I hope...
if django.VERSION >= (1, 8):
wagtailadmin_content_type, created = ContentType.objects.get_or_create(
wagtailadmin_content_type = ContentType.objects.create(
app_label='wagtailadmin',
model='admin'
)
else:
# Django 1.7 and below require a content type name
wagtailadmin_content_type, created = ContentType.objects.get_or_create(
wagtailadmin_content_type = ContentType.objects.create(
app_label='wagtailadmin',
model='admin',
name='Wagtail admin'
)
# Create admin permission
admin_permission, created = Permission.objects.get_or_create(
admin_permission = Permission.objects.create(
content_type=wagtailadmin_content_type,
codename='access_admin',
name='Can access Wagtail admin'
@ -37,21 +37,6 @@ def create_admin_access_permissions(apps, schema_editor):
group.permissions.add(admin_permission)
def remove_admin_access_permissions(apps, schema_editor):
"""Reverse the above additions of permissions."""
ContentType = apps.get_model('contenttypes.ContentType')
Permission = apps.get_model('auth.Permission')
wagtailadmin_content_type = ContentType.objects.get(
app_label='wagtailadmin',
model='admin',
)
# This cascades to Group
Permission.objects.filter(
content_type=wagtailadmin_content_type,
codename='access_admin',
).delete()
class Migration(migrations.Migration):
dependencies = [
@ -60,5 +45,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(create_admin_access_permissions, remove_admin_access_permissions),
migrations.RunPython(create_admin_access_permissions),
]

Wyświetl plik

@ -45,15 +45,15 @@ def initial_data(apps, schema_editor):
)
# Create default site
Site.objects.get_or_create(
Site.objects.create(
hostname='localhost',
root_page_id=homepage.id,
is_default_site=True
)
# Create auth groups
moderators_group, created = Group.objects.get_or_create(name='Moderators')
editors_group, created = Group.objects.get_or_create(name='Editors')
moderators_group = Group.objects.create(name='Moderators')
editors_group = Group.objects.create(name='Editors')
# Create group permissions
GroupPagePermission.objects.create(
@ -91,31 +91,6 @@ def initial_data(apps, schema_editor):
)
def remove_initial_data(apps, schema_editor):
"""This function does nothing. The below code is commented out together
with an explanation of why we don't need to bother reversing any of the
initial data"""
pass
# This does not need to be deleted, Django takes care of it.
# page_content_type = ContentType.objects.get(
# model='page',
# app_label='wagtailcore',
# )
# Page objects: Do nothing, the table will be deleted when reversing 0001
# Do not reverse Site creation since other models might depend on it
# Remove auth groups -- is this safe? External objects might depend
# on these groups... seems unsafe.
# Group.objects.filter(
# name__in=('Moderators', 'Editors')
# ).delete()
#
# Likewise, we're leaving all GroupPagePermission unchanged as users may
# have been assigned such permissions and its harmless to leave them.
class Migration(migrations.Migration):
replaces = [
@ -331,6 +306,6 @@ class Migration(migrations.Migration):
options={'verbose_name': 'Site'},
),
migrations.RunPython(
initial_data, remove_initial_data
initial_data,
),
]

Wyświetl plik

@ -81,31 +81,6 @@ def initial_data(apps, schema_editor):
)
def remove_initial_data(apps, schema_editor):
"""This function does nothing. The below code is commented out together
with an explanation of why we don't need to bother reversing any of the
initial data"""
pass
# This does not need to be deleted, Django takes care of it.
# page_content_type = ContentType.objects.get(
# model='page',
# app_label='wagtailcore',
# )
# Page objects: Do nothing, the table will be deleted when reversing 0001
# Do not reverse Site creation since other models might depend on it
# Remove auth groups -- is this safe? External objects might depend
# on these groups... seems unsafe.
# Group.objects.filter(
# name__in=('Moderators', 'Editors')
# ).delete()
#
# Likewise, we're leaving all GroupPagePermission unchanged as users may
# have been assigned such permissions and its harmless to leave them.
class Migration(migrations.Migration):
dependencies = [
@ -113,5 +88,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(initial_data, remove_initial_data),
migrations.RunPython(initial_data),
]

Wyświetl plik

@ -38,20 +38,6 @@ def add_document_permissions_to_admin_groups(apps, schema_editor):
group.permissions.add(add_document_permission, change_document_permission, delete_document_permission)
def remove_document_permissions(apps, schema_editor):
"""Reverse the above additions of permissions."""
ContentType = apps.get_model('contenttypes.ContentType')
Permission = apps.get_model('auth.Permission')
document_content_type = ContentType.objects.get(
model='document',
app_label='wagtaildocs',
)
# This cascades to Group
Permission.objects.filter(
content_type=document_content_type,
codename__in=('add_document', 'change_document', 'delete_document'),
).delete()
class Migration(migrations.Migration):
dependencies = [
@ -62,5 +48,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(add_document_permissions_to_admin_groups, remove_document_permissions),
migrations.RunPython(add_document_permissions_to_admin_groups),
]

Wyświetl plik

@ -38,21 +38,6 @@ def add_image_permissions_to_admin_groups(apps, schema_editor):
group.permissions.add(add_image_permission, change_image_permission, delete_image_permission)
def remove_image_permissions(apps, schema_editor):
"""Reverse the above additions of permissions."""
ContentType = apps.get_model('contenttypes.ContentType')
Permission = apps.get_model('auth.Permission')
image_content_type = ContentType.objects.get(
model='image',
app_label='wagtailimages',
)
# This cascades to Group
Permission.objects.filter(
content_type=image_content_type,
codename__in=('add_image', 'change_image', 'delete_image')
).delete()
class Migration(migrations.Migration):
dependencies = [
@ -63,5 +48,5 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(add_image_permissions_to_admin_groups, remove_image_permissions),
migrations.RunPython(add_image_permissions_to_admin_groups),
]

Wyświetl plik

@ -42,11 +42,6 @@ def remove_duplicate_renditions(apps, schema_editor):
""")
def reverse_remove_duplicate_renditions(*args, **kwargs):
"""This is a no-op. The migration removes duplicates, we cannot recreate those duplicates."""
pass
class Migration(migrations.Migration):
dependencies = [
@ -54,7 +49,7 @@ class Migration(migrations.Migration):
]
operations = [
migrations.RunPython(remove_duplicate_renditions, reverse_remove_duplicate_renditions),
migrations.RunPython(remove_duplicate_renditions),
migrations.AlterField(
model_name='rendition',