diff options
author | Matthew Lemon <y@yulqen.org> | 2024-10-15 21:01:31 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-10-15 21:01:31 +0100 |
commit | eeaddb27560d723ca7d61359744ceb2709fccd2d (patch) | |
tree | 04ddbc49ae7b73d5f5a9e1716d7227aecd3b9f85 /pyblackbird_cc/contrib | |
parent | 7a3044c859043837e6c7c95bb4894d04e9b2cbc2 (diff) |
Renamed from pyblackbird_cc to alphabetlearning - everywhere
Diffstat (limited to 'pyblackbird_cc/contrib')
7 files changed, 0 insertions, 163 deletions
diff --git a/pyblackbird_cc/contrib/__init__.py b/pyblackbird_cc/contrib/__init__.py deleted file mode 100644 index 1c7ecc8..0000000 --- a/pyblackbird_cc/contrib/__init__.py +++ /dev/null @@ -1,5 +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 -""" diff --git a/pyblackbird_cc/contrib/sites/__init__.py b/pyblackbird_cc/contrib/sites/__init__.py deleted file mode 100644 index 1c7ecc8..0000000 --- a/pyblackbird_cc/contrib/sites/__init__.py +++ /dev/null @@ -1,5 +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 -""" diff --git a/pyblackbird_cc/contrib/sites/migrations/0001_initial.py b/pyblackbird_cc/contrib/sites/migrations/0001_initial.py deleted file mode 100644 index fd76afb..0000000 --- a/pyblackbird_cc/contrib/sites/migrations/0001_initial.py +++ /dev/null @@ -1,43 +0,0 @@ -import django.contrib.sites.models -from django.contrib.sites.models import _simple_domain_name_validator -from django.db import migrations -from django.db import models - - -class Migration(migrations.Migration): - - dependencies = [] - - operations = [ - migrations.CreateModel( - 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")), - ], - options={ - "ordering": ("domain",), - "db_table": "django_site", - "verbose_name": "site", - "verbose_name_plural": "sites", - }, - bases=(models.Model,), - managers=[("objects", django.contrib.sites.models.SiteManager())], - ), - ] diff --git a/pyblackbird_cc/contrib/sites/migrations/0002_alter_domain_unique.py b/pyblackbird_cc/contrib/sites/migrations/0002_alter_domain_unique.py deleted file mode 100644 index 4a44a6a..0000000 --- a/pyblackbird_cc/contrib/sites/migrations/0002_alter_domain_unique.py +++ /dev/null @@ -1,21 +0,0 @@ -import django.contrib.sites.models -from django.db import migrations -from django.db import 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/pyblackbird_cc/contrib/sites/migrations/0003_set_site_domain_and_name.py b/pyblackbird_cc/contrib/sites/migrations/0003_set_site_domain_and_name.py deleted file mode 100644 index f4b1cbb..0000000 --- a/pyblackbird_cc/contrib/sites/migrations/0003_set_site_domain_and_name.py +++ /dev/null @@ -1,63 +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_or_create_site_with_sequence(site_model, connection, domain, name): - """Update or create the site with default ID and keep the DB sequence in sync.""" - site, created = site_model.objects.update_or_create( - id=settings.SITE_ID, - defaults={ - "domain": domain, - "name": name, - }, - ) - if created: - # We provided the ID explicitly when creating the Site entry, therefore the DB - # sequence to auto-generate them wasn't used and is now out of sync. If we - # don't do anything, we'll get a unique constraint violation the next time a - # site is created. - # To avoid this, we need to manually update DB sequence and make sure it's - # greater than the maximum value. - max_id = site_model.objects.order_by("-id").first().id - with connection.cursor() as cursor: - cursor.execute("SELECT last_value from django_site_id_seq") - (current_id,) = cursor.fetchone() - if current_id <= max_id: - cursor.execute( - "alter sequence django_site_id_seq restart with %s", - [max_id + 1], - ) - - -def update_site_forward(apps, schema_editor): - """Set site domain and name.""" - Site = apps.get_model("sites", "Site") - _update_or_create_site_with_sequence( - Site, - schema_editor.connection, - "resources.joannalemon.com", - "pyblackbird-cc", - ) - - -def update_site_backward(apps, schema_editor): - """Revert site domain and name to default.""" - Site = apps.get_model("sites", "Site") - _update_or_create_site_with_sequence( - Site, - schema_editor.connection, - "example.com", - "example.com", - ) - - -class Migration(migrations.Migration): - - dependencies = [("sites", "0002_alter_domain_unique")] - - operations = [migrations.RunPython(update_site_forward, update_site_backward)] diff --git a/pyblackbird_cc/contrib/sites/migrations/0004_alter_options_ordering_domain.py b/pyblackbird_cc/contrib/sites/migrations/0004_alter_options_ordering_domain.py deleted file mode 100644 index f7118ca..0000000 --- a/pyblackbird_cc/contrib/sites/migrations/0004_alter_options_ordering_domain.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 3.1.7 on 2021-02-04 14:49 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ("sites", "0003_set_site_domain_and_name"), - ] - - operations = [ - migrations.AlterModelOptions( - name="site", - options={ - "ordering": ["domain"], - "verbose_name": "site", - "verbose_name_plural": "sites", - }, - ), - ] diff --git a/pyblackbird_cc/contrib/sites/migrations/__init__.py b/pyblackbird_cc/contrib/sites/migrations/__init__.py deleted file mode 100644 index 1c7ecc8..0000000 --- a/pyblackbird_cc/contrib/sites/migrations/__init__.py +++ /dev/null @@ -1,5 +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 -""" |