From b0887c632d05d9cc5cd567be1939f6e6f0591b16 Mon Sep 17 00:00:00 2001 From: actlikewill Date: Thu, 3 Oct 2024 09:35:25 +0300 Subject: [PATCH] adds migrations for allusers --- peachjam/migrations/0163_allusers_group.py | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 peachjam/migrations/0163_allusers_group.py diff --git a/peachjam/migrations/0163_allusers_group.py b/peachjam/migrations/0163_allusers_group.py new file mode 100644 index 000000000..0eaa175e9 --- /dev/null +++ b/peachjam/migrations/0163_allusers_group.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.15 on 2024-10-03 05:27 + +from django.db import migrations + + +def set_allusers(apps, schema_editor): + User = apps.get_model("auth", "User") + Group = apps.get_model("auth", "Group") + allusers_group, _ = Group.objects.get_or_create(name="AllUsers") + + for user in User.objects.all(): + user.groups.add(allusers_group) + + +class Migration(migrations.Migration): + + dependencies = [ + ("peachjam", "0162_make_image_filenames_unique"), + ] + + operations = [ + migrations.RunPython(set_allusers, migrations.RunPython.noop), + ]