Notification emails #80
@ -1,38 +0,0 @@
|
|||||||
# Generated by Django 4.2.11 on 2024-04-15 10:18
|
|
||||||
|
|
||||||
from actstream.actions import follow
|
|
||||||
from django.contrib.auth.models import Group
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
from constants.activity import Flag
|
|
||||||
|
|
||||||
|
|
||||||
def setup_followers(apps, schema_editor):
|
|
||||||
# !!! not using apps.get_model('extensions', 'Extension')
|
|
||||||
# because it doesn't work with actstream.registry:
|
|
||||||
#
|
|
||||||
# File ".../site-packages/actstream/actions.py", line 34, in follow
|
|
||||||
# check(obj)
|
|
||||||
# File ".../site-packages/actstream/registry.py", line 105, in check
|
|
||||||
# raise ImproperlyConfigured(
|
|
||||||
# django.core.exceptions.ImproperlyConfigured: The model Extension is not registered.
|
|
||||||
# Please use actstream.registry to register it.
|
|
||||||
#
|
|
||||||
# if this ever causes issues in the future, delete this code or find a workaround
|
|
||||||
from extensions.models import Extension
|
|
||||||
for extension in Extension.objects.all():
|
|
||||||
for user in extension.authors.all():
|
|
||||||
follow(user, extension, send_action=False, flag=Flag.AUTHOR)
|
|
||||||
for user in Group.objects.get(name='moderators').user_set.all():
|
|
||||||
follow(user, extension, send_action=False, flag=Flag.MODERATOR)
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('notifications', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RunPython(setup_followers, reverse_code=migrations.RunPython.noop),
|
|
||||||
]
|
|
Loading…
Reference in New Issue
Block a user