From cef446b96a32bd750beb27b6e94f107899a3c978 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Mon, 16 Jan 2023 16:26:59 +0100 Subject: [PATCH] add Site update command --- .../management/commands/teleforma-update-site.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 teleforma/management/commands/teleforma-update-site.py diff --git a/teleforma/management/commands/teleforma-update-site.py b/teleforma/management/commands/teleforma-update-site.py new file mode 100644 index 00000000..01e06e93 --- /dev/null +++ b/teleforma/management/commands/teleforma-update-site.py @@ -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() -- 2.39.5