26 lines
705 B
Python
26 lines
705 B
Python
# Generated by Django 5.0.4 on 2024-09-15 13:40
|
|
|
|
from django.db import migrations
|
|
|
|
def set_rules_to_ruleless_subs(apps, scheme_editor):
|
|
Subs = apps.get_model("home", "Subscription")
|
|
Rules = apps.get_model("home", "UniqueContentRule")
|
|
no_rule_subs = Subs.objects.filter(unique_content_rules=None)
|
|
|
|
guid_rule = Rules.objects.get(value="GUID")
|
|
id_rule = Rules.objects.get(value="ID")
|
|
|
|
for sub in no_rule_subs:
|
|
sub.unique_content_rules.set([guid_rule.pk, id_rule.pk])
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('home', '0024_initial_uniquecontentrule_data'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(set_rules_to_ruleless_subs)
|
|
]
|