From 1c5d12bc99438bdad9837e69c4e2c1873a065893 Mon Sep 17 00:00:00 2001 From: Igor Santos Date: Wed, 6 Dec 2023 17:51:59 -0300 Subject: [PATCH] fix(domains): change model name Sites to Route --- app/contrib/domains/traefik/admin.py | 6 ++-- app/contrib/domains/traefik/apps.py | 4 +-- .../migrations/0002_auto_20231206_1951.py | 28 +++++++++++++++++++ app/contrib/domains/traefik/models.py | 2 +- 4 files changed, 34 insertions(+), 6 deletions(-) create mode 100644 app/contrib/domains/traefik/migrations/0002_auto_20231206_1951.py diff --git a/app/contrib/domains/traefik/admin.py b/app/contrib/domains/traefik/admin.py index 267a95ce..22928216 100644 --- a/app/contrib/domains/traefik/admin.py +++ b/app/contrib/domains/traefik/admin.py @@ -1,11 +1,11 @@ from django.contrib import admin -from .models import Site +from .models import Route -class SiteAdmin(admin.ModelAdmin): +class RouteAdmin(admin.ModelAdmin): list_display = ("dns", "subdomain", "instance", "service") autocomplete_fields = ("dns", "subdomain") -admin.site.register(Site, SiteAdmin) \ No newline at end of file +admin.site.register(Route, RouteAdmin) \ No newline at end of file diff --git a/app/contrib/domains/traefik/apps.py b/app/contrib/domains/traefik/apps.py index 319df9cc..734ce06d 100644 --- a/app/contrib/domains/traefik/apps.py +++ b/app/contrib/domains/traefik/apps.py @@ -71,5 +71,5 @@ def ready(self): # Signals configuration from . import signals, models - post_save.connect(signals.update_traefik_config, sender=models.Site) - post_delete.connect(signals.delete_traefik_config, sender=models.Site) + post_save.connect(signals.update_traefik_config, sender=models.Route) + post_delete.connect(signals.delete_traefik_config, sender=models.Route) diff --git a/app/contrib/domains/traefik/migrations/0002_auto_20231206_1951.py b/app/contrib/domains/traefik/migrations/0002_auto_20231206_1951.py new file mode 100644 index 00000000..0ba53162 --- /dev/null +++ b/app/contrib/domains/traefik/migrations/0002_auto_20231206_1951.py @@ -0,0 +1,28 @@ +# Generated by Django 3.2 on 2023-12-06 19:51 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('route53', '0005_alter_vps_options'), + ('traefik', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Route', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('service', models.CharField(choices=[('webpage@docker', 'Public'), ('cms@docker', 'CMS')], max_length=25)), + ('dns', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='route53.hostedzone')), + ('instance', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='route53.vps')), + ('subdomain', models.ForeignKey(blank=True, limit_choices_to={'record_type': 'A'}, null=True, on_delete=django.db.models.deletion.SET_NULL, to='route53.recordset')), + ], + ), + migrations.DeleteModel( + name='Site', + ), + ] diff --git a/app/contrib/domains/traefik/models.py b/app/contrib/domains/traefik/models.py index 6bb633e3..18578d0b 100644 --- a/app/contrib/domains/traefik/models.py +++ b/app/contrib/domains/traefik/models.py @@ -9,7 +9,7 @@ class Container(models.TextChoices): djangocms = "cms@docker", "CMS" -class Site(models.Model): +class Route(models.Model): dns = models.ForeignKey(HostedZone, on_delete=models.CASCADE) subdomain = models.ForeignKey( RecordSet,