old_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.11.15 on 2020-01-14 09:33
  from __future__ import unicode_literals
  
  from django.db import migrations
  from django.db import migrations, connection
  from bluebottle.clients import properties
  
  
  def migrate_settings(apps, schema_editor):
      Client = apps.get_model('clients', 'Client')
      MemberPlatformSettings = apps.get_model('members', 'MemberPlatformSettings')
  
      tenant = Client.objects.get(schema_name=connection.tenant.schema_name)
  
      properties.set_tenant(tenant)
  
      (settings, _) = MemberPlatformSettings.objects.get_or_create()
  
      try:
          settings.closed = properties.CLOSED_SITE
      except AttributeError:
          pass
  
      try:
          if properties.TOKEN_AUTH:
              settings.login_methods = ['sso']
      except AttributeError:
          pass
  
      settings.save()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('members', '0033_auto_20200114_1050'),
      ]
  
      operations = [
          migrations.RunPython(migrate_settings)
      ]
  
new_contents: # -*- coding: utf-8 -*-
  # Generated by Django 1.11.15 on 2020-01-14 09:33
  from __future__ import unicode_literals
  
  from django.db import migrations
  from django.db import migrations, connection
  from bluebottle.clients import properties
  
  
  def migrate_settings(apps, schema_editor):
      Client = apps.get_model('clients', 'Client')
      MemberPlatformSettings = apps.get_model('members', 'MemberPlatformSettings')
  
      tenant = Client.objects.get(schema_name=connection.tenant.schema_name)
  
      properties.set_tenant(tenant)
  
      (settings, _) = MemberPlatformSettings.objects.get_or_create()
  
      try:
          settings.closed = properties.CLOSED_SITE
      except AttributeError:
          pass
  
      try:
          if properties.TOKEN_AUTH:
              settings.login_methods = ['SSO']
      except AttributeError:
          pass
  
      settings.save()
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('members', '0033_auto_20200114_1050'),
      ]
  
      operations = [
          migrations.RunPython(migrate_settings)
      ]
  
subject: Fix migration