From b96e71091f436a1433c7b8fa4723f8d06b830691 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sat, 27 Jan 2024 11:34:55 +0100 Subject: Read / Write fields can be empty --- .../0003_alter_dashboard_groups_read_and_more.py | 99 ++++++++++++++++++++++ rrd/models.py | 12 ++- 2 files changed, 107 insertions(+), 4 deletions(-) create mode 100644 rrd/migrations/0003_alter_dashboard_groups_read_and_more.py (limited to 'rrd') diff --git a/rrd/migrations/0003_alter_dashboard_groups_read_and_more.py b/rrd/migrations/0003_alter_dashboard_groups_read_and_more.py new file mode 100644 index 0000000..5a4f00e --- /dev/null +++ b/rrd/migrations/0003_alter_dashboard_groups_read_and_more.py @@ -0,0 +1,99 @@ +# Generated by Django 4.2.9 on 2024-01-27 10:34 + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("auth", "0012_alter_user_first_name_max_length"), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ("rrd", "0002_alter_dashboard_groups_read_and_more"), + ] + + operations = [ + migrations.AlterField( + model_name="dashboard", + name="groups_read", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_read", to="auth.group" + ), + ), + migrations.AlterField( + model_name="dashboard", + name="groups_write", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_write", to="auth.group" + ), + ), + migrations.AlterField( + model_name="dashboard", + name="users_read", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_read", to=settings.AUTH_USER_MODEL + ), + ), + migrations.AlterField( + model_name="dashboard", + name="users_write", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_write", to=settings.AUTH_USER_MODEL + ), + ), + migrations.AlterField( + model_name="datasource", + name="groups_read", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_read", to="auth.group" + ), + ), + migrations.AlterField( + model_name="datasource", + name="groups_write", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_write", to="auth.group" + ), + ), + migrations.AlterField( + model_name="datasource", + name="users_read", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_read", to=settings.AUTH_USER_MODEL + ), + ), + migrations.AlterField( + model_name="datasource", + name="users_write", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_write", to=settings.AUTH_USER_MODEL + ), + ), + migrations.AlterField( + model_name="graph", + name="groups_read", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_read", to="auth.group" + ), + ), + migrations.AlterField( + model_name="graph", + name="groups_write", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_write", to="auth.group" + ), + ), + migrations.AlterField( + model_name="graph", + name="users_read", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_read", to=settings.AUTH_USER_MODEL + ), + ), + migrations.AlterField( + model_name="graph", + name="users_write", + field=models.ManyToManyField( + blank=True, related_name="%(class)s_write", to=settings.AUTH_USER_MODEL + ), + ), + ] diff --git a/rrd/models.py b/rrd/models.py index 2dc629a..7ccc89a 100644 --- a/rrd/models.py +++ b/rrd/models.py @@ -23,19 +23,23 @@ def _sanitize_path(path): class ModelWithPerms(models.Model): users_read = models.ManyToManyField( amodels.User, - related_name="%(class)s_read" + related_name="%(class)s_read", + blank=True, ) users_write = models.ManyToManyField( amodels.User, - related_name="%(class)s_write" + related_name="%(class)s_write", + blank=True, ) groups_read = models.ManyToManyField( amodels.Group, - related_name="%(class)s_read" + related_name="%(class)s_read", + blank=True, ) groups_write = models.ManyToManyField( amodels.Group, - related_name="%(class)s_write" + related_name="%(class)s_write", + blank=True, ) class Meta: -- cgit v1.2.3