You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

24 lines
705 B

# Generated by Django 3.2.8 on 2021-10-21 09:30
from django.db import migrations
def fill_last_notify(apps, schema_editor):
Channel = apps.get_model("api", "Channel")
Notification = apps.get_model("api", "Notification")
for channel in Channel.objects.filter(last_notify=None):
try:
n = Notification.objects.filter(channel=channel).latest()
channel.last_notify = n.created
channel.save()
except Notification.DoesNotExist:
pass
class Migration(migrations.Migration):
dependencies = [
("api", "0081_channel_last_notify"),
]
operations = [migrations.RunPython(fill_last_notify, migrations.RunPython.noop)]