agdar/core/migrations/0005_add_consent_template.py
2025-11-02 14:35:35 +03:00

38 lines
2.2 KiB
Python

# Generated by Django 5.2.3 on 2025-10-28 00:20
import django.db.models.deletion
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_historicaluser_bio_historicaluser_email_verified_and_more'),
]
operations = [
migrations.CreateModel(
name='ConsentTemplate',
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')),
('consent_type', models.CharField(choices=[('GENERAL_TREATMENT', 'General Treatment'), ('SERVICE_SPECIFIC', 'Service Specific'), ('PHOTO_VIDEO', 'Photo/Video'), ('DATA_SHARING', 'Data Sharing')], max_length=30, verbose_name='Consent Type')),
('title_en', models.CharField(max_length=200, verbose_name='Title (English)')),
('title_ar', models.CharField(blank=True, max_length=200, verbose_name='Title (Arabic)')),
('content_en', models.TextField(help_text='Consent text in English. Use {patient_name}, {patient_mrn}, {date} as placeholders.', verbose_name='Content (English)')),
('content_ar', models.TextField(blank=True, help_text='Consent text in Arabic. Use {patient_name}, {patient_mrn}, {date} as placeholders.', verbose_name='Content (Arabic)')),
('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
('version', models.PositiveIntegerField(default=1, verbose_name='Version')),
('tenant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s_related', to='core.tenant', verbose_name='Tenant')),
],
options={
'verbose_name': 'Consent Template',
'verbose_name_plural': 'Consent Templates',
'ordering': ['consent_type', '-version'],
'unique_together': {('tenant', 'consent_type', 'version')},
},
),
]