# Path: courriers/settings.py
# ALLOWED_LANGUAGES = getattr(settings, "COURRIERS_ALLOWED_LANGUAGES", settings.LANGUAGES)


import os
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.template.defaultfilters import slugify, truncatechars
from django.utils.translation import gettext_lazy as _
from django.utils import timezone as datetime
from django.urls import reverse
from django.db.models.query import QuerySet
from courriers.settings import ALLOWED_LANGUAGES
    newsletter_segment = models.ForeignKey(
        "courriers.NewsletterSegment", related_name="segments", on_delete=models.PROTECT
    )
    sent = models.BooleanField(default=False, db_index=True)

    objects = NewsletterManager()

    class Meta:
        abstract = True

    def __str__(self):
        return self.name or ""

    def get_previous(self):
        return self.__class__.objects.filter(
            newsletter_list=self.newsletter_list_id
        ).get_previous(self.published_at)

    def get_next(self):
        return self.__class__.objects.filter(
            newsletter_list=self.newsletter_list_id
        ).get_next(self.published_at)

    def is_online(self):
        return self.status == self.STATUS_ONLINE

    def get_absolute_url(self):
        return reverse("newsletter_detail", args=[self.pk])



# Path: courriers/settings.py
# ALLOWED_LANGUAGES = getattr(settings, "COURRIERS_ALLOWED_LANGUAGES", settings.LANGUAGES)


# Path: courriers/base_models.py
import os
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.template.defaultfilters import slugify, truncatechars
from django.utils.translation import gettext_lazy as _
from django.utils import timezone as datetime
from django.urls import reverse
from django.db.models.query import QuerySet
from courriers.settings import ALLOWED_LANGUAGES

    newsletter_segment = models.ForeignKey(
        "courriers.NewsletterSegment", related_name="segments", on_delete=models.PROTECT
    )
    sent = models.BooleanField(default=False, db_index=True)

    objects = NewsletterManager()

    class Meta:
        abstract = True

    def __str__(self):
        return self.name or ""

    def get_previous(self):
        return self.__class__.objects.filter(
            newsletter_list=self.newsletter_list_id
        ).get_previous(self.published_at)

    def get_next(self):
        return self.__class__.objects.filter(
            newsletter_list=self.newsletter_list_id
        ).get_next(self.published_at)

    def is_online(self):
        return self.status == self.STATUS_ONLINE

    def get_absolute_url(self):
        return reverse("newsletter_detail", args=[self.pk])



class NewsletterItem(models.Model):