From eecc3b65042f6402208016a2204e6b7d556ce718 Mon Sep 17 00:00:00 2001
From: Ernesto Rico Schmidt <ernesto@helsinki.at>
Date: Tue, 11 Jun 2024 15:06:25 -0400
Subject: [PATCH] feat: add permissions to edit Host email, image & owners
 fields

---
 program/migrations/0097_alter_host_options.py | 27 +++++++++++++++++++
 program/models.py                             |  7 +++--
 2 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 program/migrations/0097_alter_host_options.py

diff --git a/program/migrations/0097_alter_host_options.py b/program/migrations/0097_alter_host_options.py
new file mode 100644
index 00000000..0a08f37d
--- /dev/null
+++ b/program/migrations/0097_alter_host_options.py
@@ -0,0 +1,27 @@
+# Generated by Django 4.2.13 on 2024-06-11 19:02
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ("program", "0096_alter_category_description_alter_category_is_active_and_more"),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name="host",
+            options={
+                "ordering": ("name",),
+                "permissions": [
+                    ("edit__host__biography", "Can edit biography field"),
+                    ("edit__host__email", "Can edit email field"),
+                    ("edit__host__image", "Can edit image field"),
+                    ("edit__host__name", "Can edit name field"),
+                    ("edit__host__owners", "Can edit owners field"),
+                    ("update_host", "Can update host"),
+                ],
+            },
+        ),
+    ]
diff --git a/program/models.py b/program/models.py
index 16886c5b..80070c35 100644
--- a/program/models.py
+++ b/program/models.py
@@ -180,8 +180,11 @@ class Host(models.Model):
     class Meta:
         ordering = ("name",)
         permissions = [
-            ("edit__host__biography", "Can edit Host biography field"),
-            ("edit__host__name", "Can edit Host name field"),
+            ("edit__host__biography", "Can edit biography field"),
+            ("edit__host__email", "Can edit email field"),
+            ("edit__host__image", "Can edit image field"),
+            ("edit__host__name", "Can edit name field"),
+            ("edit__host__owners", "Can edit owners field"),
             # overrides ownership
             ("update_host", "Can update host"),
         ]
-- 
GitLab