aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/contrib/sites
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-02-18 16:07:33 +0000
committerMatthew Lemon <lemon@matthewlemon.com>2020-02-18 16:07:33 +0000
commitf739c571945dce2407a97c2b87ed5867b77a5f3d (patch)
tree3e01203de5e9e2a8dc99a323a8b2978c8b9f1459 /ctrack/contrib/sites
parent52dab6236c433bd4ee34f03bf7bae470cf384d8a (diff)
start fresh with migrations - might have to DROP DB and migrate again
Diffstat (limited to 'ctrack/contrib/sites')
-rw-r--r--ctrack/contrib/sites/migrations/0001_initial.py46
-rw-r--r--ctrack/contrib/sites/migrations/0002_alter_domain_unique.py20
-rw-r--r--ctrack/contrib/sites/migrations/0003_set_site_domain_and_name.py34
3 files changed, 18 insertions, 82 deletions
diff --git a/ctrack/contrib/sites/migrations/0001_initial.py b/ctrack/contrib/sites/migrations/0001_initial.py
index 304cd6d..fddaae2 100644
--- a/ctrack/contrib/sites/migrations/0001_initial.py
+++ b/ctrack/contrib/sites/migrations/0001_initial.py
@@ -1,42 +1,32 @@
+# Generated by Django 2.2.9 on 2020-02-18 16:05
+
import django.contrib.sites.models
-from django.contrib.sites.models import _simple_domain_name_validator
from django.db import migrations, models
class Migration(migrations.Migration):
- dependencies = []
+ initial = True
+
+ dependencies = [
+ ]
operations = [
migrations.CreateModel(
- name="Site",
+ name='Site',
fields=[
- (
- "id",
- models.AutoField(
- verbose_name="ID",
- serialize=False,
- auto_created=True,
- primary_key=True,
- ),
- ),
- (
- "domain",
- models.CharField(
- max_length=100,
- verbose_name="domain name",
- validators=[_simple_domain_name_validator],
- ),
- ),
- ("name", models.CharField(max_length=50, verbose_name="display name")),
+ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('domain', models.CharField(max_length=100, unique=True, validators=[django.contrib.sites.models._simple_domain_name_validator], verbose_name='domain name')),
+ ('name', models.CharField(max_length=50, verbose_name='display name')),
],
options={
- "ordering": ("domain",),
- "db_table": "django_site",
- "verbose_name": "site",
- "verbose_name_plural": "sites",
+ 'verbose_name': 'site',
+ 'verbose_name_plural': 'sites',
+ 'db_table': 'django_site',
+ 'ordering': ('domain',),
},
- bases=(models.Model,),
- managers=[("objects", django.contrib.sites.models.SiteManager())],
- )
+ managers=[
+ ('objects', django.contrib.sites.models.SiteManager()),
+ ],
+ ),
]
diff --git a/ctrack/contrib/sites/migrations/0002_alter_domain_unique.py b/ctrack/contrib/sites/migrations/0002_alter_domain_unique.py
deleted file mode 100644
index 2c8d6da..0000000
--- a/ctrack/contrib/sites/migrations/0002_alter_domain_unique.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import django.contrib.sites.models
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [("sites", "0001_initial")]
-
- operations = [
- migrations.AlterField(
- model_name="site",
- name="domain",
- field=models.CharField(
- max_length=100,
- unique=True,
- validators=[django.contrib.sites.models._simple_domain_name_validator],
- verbose_name="domain name",
- ),
- )
- ]
diff --git a/ctrack/contrib/sites/migrations/0003_set_site_domain_and_name.py b/ctrack/contrib/sites/migrations/0003_set_site_domain_and_name.py
deleted file mode 100644
index e81e91e..0000000
--- a/ctrack/contrib/sites/migrations/0003_set_site_domain_and_name.py
+++ /dev/null
@@ -1,34 +0,0 @@
-"""
-To understand why this file is here, please read:
-
-http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
-"""
-from django.conf import settings
-from django.db import 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": "ctrackdft.net",
- "name": "ctrack",
- },
- )
-
-
-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", "0002_alter_domain_unique")]
-
- operations = [migrations.RunPython(update_site_forward, update_site_backward)]