old_contents: # Generated by Django 2.2.9 on 2020-01-08 16:06
  
  from django.db import migrations
  
  def admin_status_in_user_field(apps, schema_editor):
      User = apps.get_model('main', 'User')
      superadmins = User.objects.filter(roles__name='superadmin')
      superadmins.update(is_staff=True, is_superuser=True)
  
  def revert_admin(apps, schema_editor):
      User = apps.get_model('main', 'User')
      superadmins = User.objects.filter(roles__name='superadmin')
      superadmins.update(is_staff=False, is_superuser=False)
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('main', '0029_auto_20200108_1604'),
      ]
  
      operations = [
          migrations.RunPython(admin_status_in_user_field, revert_admin),
      ]
  
new_contents: # Generated by Django 2.2.9 on 2020-01-08 16:06
  
  from django.db import migrations
  
  def admin_status_in_user_field(apps, schema_editor):
      User = apps.get_model('main', 'User')
      superadmins = User.objects.filter(roles__name='superadmin')
      superadmins.update(is_staff=True, is_superuser=True)
  
  def admin_status_via_role_relationship(apps, schema_editor):
      User = apps.get_model('main', 'User')
      Role = apps.get_model('main', 'Role')
      role, _created = Role.objects.get_or_create(name='superadmin')
  
      superadmins = User.objects.filter(is_staff=True, is_superuser=True)
      for admin in superadmins:
          admin.roles.add(role)
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('main', '0029_auto_20200108_1604'),
      ]
  
      operations = [
          migrations.RunPython(admin_status_in_user_field, admin_status_via_role_relationship),
      ]
  
subject: Correct reverse migration.