Add EmailSettings model with migration

This commit is contained in:
Eduardo Silva 2025-02-25 09:21:50 -03:00
parent ea9596b4bc
commit b7ae6f1421
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,31 @@
# Generated by Django 5.1.5 on 2025-02-25 12:21
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='EmailSettings',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(default='email_settings', max_length=20, unique=True)),
('smtp_username', models.CharField(blank=True, max_length=100, null=True)),
('smtp_password', models.CharField(blank=True, max_length=100, null=True)),
('smtp_host', models.CharField(blank=True, max_length=100, null=True)),
('smtp_port', models.IntegerField(default=587)),
('smtp_encryption', models.CharField(choices=[('ssl', 'SSL'), ('tls', 'TLS')], default='tls', max_length=3)),
('smtp_from_address', models.EmailField(blank=True, max_length=254, null=True)),
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
],
),
]

View File

@ -1,3 +1,16 @@
from django.db import models
import uuid
# Create your models here.
class EmailSettings(models.Model):
name = models.CharField(default='email_settings', max_length=20, unique=True)
smtp_username = models.CharField(max_length=100, blank=True, null=True)
smtp_password = models.CharField(max_length=100, blank=True, null=True)
smtp_host = models.CharField(max_length=100, blank=True, null=True)
smtp_port = models.IntegerField(default=587)
smtp_encryption = models.CharField(default='tls', choices=(('ssl', 'SSL'), ('tls', 'TLS')), max_length=3)
smtp_from_address = models.EmailField(blank=True, null=True)
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)