from __future__ import unicode_literals

from django.conf import settings
from django.db import models, migrations


def update_site_forward(apps, schema_editor):
    """Set site domain and name."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "poradnia.informacjapubliczna.org.pl",
            "name": "poradnia"
        }
    )


def update_site_backward(apps, schema_editor):
    """Revert site domain and name to default."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "example.com",
            "name": "example.com"
        }
    )


class Migration(migrations.Migration):

    dependencies = [
        ('sites', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(update_site_forward, update_site_backward),
    ]

from __future__ import unicode_literals

from django.conf import settings
from django.db import models, migrations


def update_site_forward(apps, schema_editor):
    """Set site domain and name."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "porady.siecobywatelska.pl",
            "name": "poradnia"
        }
    )


def update_site_backward(apps, schema_editor):
    """Revert site domain and name to default."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "example.com",
            "name": "example.com"
        }
    )


class Migration(migrations.Migration):

    dependencies = [
        ('sites', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(update_site_forward, update_site_backward),
    ]

Fix migrations - drop old domain
Fix migrations - drop old domain

  from __future__ import unicode_literals
  
  from django.conf import settings
  from django.db import models, migrations
  
  
  def update_site_forward(apps, schema_editor):
      """Set site domain and name."""
      Site = apps.get_model("sites", "Site")
      Site.objects.update_or_create(
          id=settings.SITE_ID,
          defaults={
-             "domain": "poradnia.informacjapubliczna.org.pl",
+             "domain": "porady.siecobywatelska.pl",
              "name": "poradnia"
          }
      )
  
  
  def update_site_backward(apps, schema_editor):
      """Revert site domain and name to default."""
      Site = apps.get_model("sites", "Site")
      Site.objects.update_or_create(
          id=settings.SITE_ID,
          defaults={
              "domain": "example.com",
              "name": "example.com"
          }
      )
  
  
  class Migration(migrations.Migration):
  
      dependencies = [
          ('sites', '0001_initial'),
      ]
  
      operations = [
          migrations.RunPython(update_site_forward, update_site_backward),
      ]
  
Fix migrations - drop old domain
## Code Before:
from __future__ import unicode_literals

from django.conf import settings
from django.db import models, migrations


def update_site_forward(apps, schema_editor):
    """Set site domain and name."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "poradnia.informacjapubliczna.org.pl",
            "name": "poradnia"
        }
    )


def update_site_backward(apps, schema_editor):
    """Revert site domain and name to default."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "example.com",
            "name": "example.com"
        }
    )


class Migration(migrations.Migration):

    dependencies = [
        ('sites', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(update_site_forward, update_site_backward),
    ]

## Instruction:
Fix migrations - drop old domain
## Code After:
from __future__ import unicode_literals

from django.conf import settings
from django.db import models, migrations


def update_site_forward(apps, schema_editor):
    """Set site domain and name."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "porady.siecobywatelska.pl",
            "name": "poradnia"
        }
    )


def update_site_backward(apps, schema_editor):
    """Revert site domain and name to default."""
    Site = apps.get_model("sites", "Site")
    Site.objects.update_or_create(
        id=settings.SITE_ID,
        defaults={
            "domain": "example.com",
            "name": "example.com"
        }
    )


class Migration(migrations.Migration):

    dependencies = [
        ('sites', '0001_initial'),
    ]

    operations = [
        migrations.RunPython(update_site_forward, update_site_backward),
    ]
