✨(mailbox_manager) modify API to get maildomain
Access to maildomain by slug name
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-03 14:14
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mailbox_manager', '0002_alter_maildomainaccess_domain'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='maildomain',
|
||||
name='slug',
|
||||
field=models.SlugField(blank=True, max_length=80),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-03 14:14
|
||||
|
||||
from django.db import migrations, models
|
||||
from django.utils.text import slugify
|
||||
|
||||
|
||||
def populate_slug(apps, schema_editor):
|
||||
MailDomain = apps.get_model('mailbox_manager', 'MailDomain')
|
||||
for mail_domain in MailDomain.objects.filter(slug=''):
|
||||
mail_domain.slug = slugify(mail_domain.name)
|
||||
mail_domain.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mailbox_manager', '0003_maildomain_slug'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(populate_slug, reverse_code=migrations.RunPython.noop),
|
||||
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-03 14:20
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mailbox_manager', '0004_maildomain_fill_slug'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='maildomain',
|
||||
name='slug',
|
||||
field=models.SlugField(max_length=80, unique=True),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user