Skip to content

Commit

Permalink
fix(domains): change model name Sites to Route
Browse files Browse the repository at this point in the history
  • Loading branch information
igr-santos committed Dec 6, 2023
1 parent d83e3b2 commit 1c5d12b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 6 deletions.
6 changes: 3 additions & 3 deletions app/contrib/domains/traefik/admin.py
Original file line number Diff line number Diff line change
@@ -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)
admin.site.register(Route, RouteAdmin)
4 changes: 2 additions & 2 deletions app/contrib/domains/traefik/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
28 changes: 28 additions & 0 deletions app/contrib/domains/traefik/migrations/0002_auto_20231206_1951.py
Original file line number Diff line number Diff line change
@@ -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',
),
]
2 changes: 1 addition & 1 deletion app/contrib/domains/traefik/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1c5d12b

Please sign in to comment.