feat: admin panel enrichment
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import os
|
||||
|
||||
from django.apps import AppConfig
|
||||
from django.db.models.signals import post_migrate
|
||||
|
||||
|
||||
def ensure_site(sender, **kwargs):
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
domain = os.environ.get("SITE_DOMAIN", "localhost:8000")
|
||||
Site.objects.update_or_create(
|
||||
id=getattr(settings, "SITE_ID", 1),
|
||||
defaults={"domain": domain, "name": "Tecvico"},
|
||||
)
|
||||
|
||||
|
||||
class AccountsConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "apps.accounts"
|
||||
label = "accounts"
|
||||
|
||||
def ready(self):
|
||||
from . import signals # noqa: F401
|
||||
|
||||
post_migrate.connect(ensure_site, sender=self)
|
||||
Reference in New Issue
Block a user