[extensions-web] extensions: don't cascade drop extensions with their authors.
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] extensions: don't cascade drop extensions with their authors.
- Date: Sat, 23 Nov 2019 18:50:13 +0000 (UTC)
commit 7ce9f7a3f0e9f50d209c4861321eace556235705
Author: Yuri Konotopov <ykonotopov gnome org>
Date: Sat Nov 23 22:49:31 2019 +0400
extensions: don't cascade drop extensions with their authors.
Closes: https://gitlab.gnome.org/Infrastructure/extensions-web/issues/75
.../extensions/migrations/0006_auto_20191123_2146.py | 20 ++++++++++++++++++++
sweettooth/extensions/models.py | 2 +-
2 files changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/sweettooth/extensions/migrations/0006_auto_20191123_2146.py
b/sweettooth/extensions/migrations/0006_auto_20191123_2146.py
new file mode 100644
index 0000000..69efa78
--- /dev/null
+++ b/sweettooth/extensions/migrations/0006_auto_20191123_2146.py
@@ -0,0 +1,20 @@
+# Generated by Django 2.2.7 on 2019-11-23 21:46
+
+from django.conf import settings
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('extensions', '0005_auto_20190112_1733'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='extension',
+ name='creator',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
to=settings.AUTH_USER_MODEL),
+ ),
+ ]
diff --git a/sweettooth/extensions/models.py b/sweettooth/extensions/models.py
index 88857d1..67e283f 100644
--- a/sweettooth/extensions/models.py
+++ b/sweettooth/extensions/models.py
@@ -93,7 +93,7 @@ class Extension(models.Model):
name = models.CharField(max_length=200)
uuid = models.CharField(max_length=200, unique=True, db_index=True)
slug = autoslug.AutoSlugField(populate_from="name")
- creator = models.ForeignKey(User, db_index=True, on_delete=models.CASCADE)
+ creator = models.ForeignKey(User, db_index=True, on_delete=models.PROTECT)
description = models.TextField(blank=True)
url = models.URLField(blank=True)
created = models.DateTimeField(auto_now_add=True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]