Files
n3wt-school/Back-End/Settings/models.py
2025-05-27 19:59:53 +02:00

25 lines
930 B
Python

from django.contrib.auth.models import AbstractUser
from django.db import models
from django.utils.translation import gettext_lazy as _
from django.conf import settings
from Establishment.models import Establishment
class MailSettings(models.Model):
establishment = models.ForeignKey(Establishment, on_delete=models.CASCADE)
# Paramètres communs (si tu veux un seul user/pass pour SMTP et IMAP)
mail_user = models.CharField(max_length=255)
mail_password = models.CharField(max_length=255)
# SMTP
smtp_server = models.CharField(max_length=255)
smtp_port = models.PositiveIntegerField()
use_tls = models.BooleanField(default=True)
use_ssl = models.BooleanField(default=False)
# IMAP
imap_server = models.CharField(max_length=255)
imap_port = models.PositiveIntegerField(default=993)
def __str__(self):
return f"MailSettings ({self.establishment} - {self.mail_user})"