in pulseapi/entries/migrations/0010_migrate_approval_flags.py [0:0]
def forwards_func(apps, schema_editor):
approved = ModerationState.objects.get(name='Approved')
entries = apps.get_model('entries', 'Entry').objects.all()
for entry in entries:
if entry.is_approved:
migrated_entry = Entry.objects.filter(
title=entry.title,
content_url=entry.content_url
)
for m_entry in migrated_entry:
m_entry.moderation_state = approved
m_entry.save()