Set on_delete action to SET_NULL on Document.uploaded_by_user

This prevents deletion of users from deleting any Documents they have uploaded.

This is already the behaviour on images.
pull/2064/merge
Karl Hobley 2015-12-22 16:07:44 +00:00 zatwierdzone przez Matt Westcott
rodzic b70823f2aa
commit 8ef846d214
4 zmienionych plików z 26 dodań i 1 usunięć

Wyświetl plik

@ -17,6 +17,7 @@ Changelog
* Fix: Fixed typo in Wistia oEmbed pattern (Josh Hurd)
* Fix: Added more accurate help text for the Administrator flag on user accounts (Matt Fozard)
* Fix: Tags added on the multiple image uploader are now saved correctly
* Fix: Documents created by a user are no longer deleted when the user is deleted
1.3.1 (05.01.2016)
~~~~~~~~~~~~~~~~~~

Wyświetl plik

@ -36,6 +36,7 @@ Bug fixes
* Fixed typo in Wistia oEmbed pattern (Josh Hurd)
* Added more accurate help text for the Administrator flag on user accounts (Matt Fozard)
* Tags added on the multiple image uploader are now saved correctly
* Documents created by a user are no longer deleted when the user is deleted
Upgrade considerations

Wyświetl plik

@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2015-12-22 16:09
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtaildocs', '0004_capitalizeverbose'),
]
operations = [
migrations.AlterField(
model_name='document',
name='uploaded_by_user',
field=models.ForeignKey(blank=True, editable=False, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='uploaded by user'),
),
]

Wyświetl plik

@ -34,7 +34,8 @@ class AbstractDocument(models.Model, TagSearchable):
verbose_name=_('uploaded by user'),
null=True,
blank=True,
editable=False
editable=False,
on_delete=models.SET_NULL
)
tags = TaggableManager(help_text=None, blank=True, verbose_name=_('tags'))