from django.conf import settings
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.db import models


class CustomFlatPage(FlatPage):
    objects = models.Manager()

    class Meta:
        verbose_name = "Statische Webseite"
        verbose_name_plural = "Statische Webseiten"

    def save(self, *args, **kwargs):
        super().save(*args, **kwargs)
        self.sites.set([Site.objects.get(pk=settings.SITE_ID)])
