agdar/core/migrations/0007_contactmessage.py
Marwan Alwali 4e10003711 update
2025-11-04 01:30:37 +03:00

43 lines
2.5 KiB
Python

# Generated by Django 5.2.3 on 2025-11-03 09:57
import django.db.models.deletion
import phonenumber_field.modelfields
import uuid
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0006_add_consent_token'),
]
operations = [
migrations.CreateModel(
name='ContactMessage',
fields=[
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created At')),
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated At')),
('name', models.CharField(max_length=200, verbose_name='Name')),
('email', models.EmailField(max_length=254, verbose_name='Email')),
('phone', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None, verbose_name='Phone Number')),
('message', models.TextField(verbose_name='Message')),
('submitted_at', models.DateTimeField(auto_now_add=True, verbose_name='Submitted At')),
('ip_address', models.GenericIPAddressField(blank=True, null=True, verbose_name='IP Address')),
('user_agent', models.TextField(blank=True, help_text='Browser and device information', verbose_name='User Agent')),
('is_read', models.BooleanField(default=False, help_text='Whether an admin has viewed this message', verbose_name='Is Read')),
('responded_at', models.DateTimeField(blank=True, null=True, verbose_name='Responded At')),
('notes', models.TextField(blank=True, help_text='Internal notes about this inquiry', verbose_name='Admin Notes')),
('responded_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='responded_contact_messages', to=settings.AUTH_USER_MODEL, verbose_name='Responded By')),
],
options={
'verbose_name': 'Contact Message',
'verbose_name_plural': 'Contact Messages',
'ordering': ['-submitted_at'],
'indexes': [models.Index(fields=['email'], name='core_contac_email_cfac76_idx'), models.Index(fields=['is_read', 'submitted_at'], name='core_contac_is_read_1e7207_idx'), models.Index(fields=['submitted_at'], name='core_contac_submitt_1fa785_idx')],
},
),
]