]> git.parisson.com Git - teleforma.git/commitdiff
add Site update command
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 16 Jan 2023 15:26:59 +0000 (16:26 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 16 Jan 2023 15:27:36 +0000 (16:27 +0100)
teleforma/management/commands/teleforma-update-site.py [new file with mode: 0644]

diff --git a/teleforma/management/commands/teleforma-update-site.py b/teleforma/management/commands/teleforma-update-site.py
new file mode 100644 (file)
index 0000000..01e06e9
--- /dev/null
@@ -0,0 +1,15 @@
+from django.core.management.base import BaseCommand
+from django.contrib.sites.models import Site
+from django.conf import settings
+
+
+class Command(BaseCommand):
+    help = "Change Site domain to another"
+    
+    def handle(self, *args, **options):
+        to_domain = args[-1]
+        from_domain = args[-2]
+
+        site = Site.objects.get(domain=from_domain)
+        site.domain = to_domain
+        site.save()