loko/streetup/controls/migrations/0001_initial.py

206 lines
12 KiB
Python

# Generated by Django 6.0.7 on 2026-07-22 13:42
import common.storages
import django.contrib.gis.db.models.fields
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('assets', '0002_initial'),
('common', '0002_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='ControlCheck',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.CharField(choices=[('ok', 'OK'), ('nok', 'NOK'), ('na', 'N/A'), ('nv', 'Not verified')], default='nv')),
],
),
migrations.CreateModel(
name='ControlQuantity',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.CharField(blank=True, max_length=255, null=True)),
('q1', models.DecimalField(decimal_places=2, max_digits=12)),
('q2', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
('q3', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True)),
('computed_qty', models.DecimalField(decimal_places=2, default=0, editable=False, max_digits=14)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'ordering': ['created_at', 'id'],
},
),
migrations.CreateModel(
name='ControlReferencePlan',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('plan', models.FileField(max_length=255, storage=common.storages.PrivateMediaStorage(), upload_to='control_plans/', verbose_name='Plan')),
('uploaded_at', models.DateTimeField(auto_now=True)),
('max_x', models.FloatField(blank=True, null=True)),
('max_y', models.FloatField(blank=True, null=True)),
],
options={
'ordering': ['control', 'name'],
},
),
migrations.CreateModel(
name='ControlReport',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('status', models.CharField(choices=[('active', 'Actif'), ('validated', 'Validé'), ('archived', 'Archivé'), ('canceled', 'Annulé')], default='active')),
('document', models.FileField(max_length=255, storage=common.storages.PrivateMediaStorage(), upload_to='control_reports/', verbose_name='Document')),
],
options={
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='ControlReportTemplate',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(default='Template standard', max_length=255)),
('orientation', models.CharField(choices=[('portrait', 'Portrait'), ('landscape', 'Paysage')], default='portrait', max_length=10)),
('header_notes', models.TextField(blank=True, null=True)),
('footer_notes', models.TextField(blank=True, null=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='DocumentCheck',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('doc_type', models.CharField(choices=[('as_built', 'Plan as-built'), ('techical_sheets', 'Fiches techniques')], default='as_built')),
('status', models.CharField(choices=[('ok', 'OK'), ('nok', 'NOK'), ('na', 'N/A'), ('nv', 'Not verified')], default='nv')),
],
),
migrations.CreateModel(
name='Remark',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField()),
('internal', models.BooleanField(default=False)),
('status', models.CharField(choices=[('information', 'Info'), ('to_be_processed', 'NOK'), ('processed', 'Traité'), ('validated', 'OK'), ('canceled', 'Annulé')], default='to_be_processed')),
('archived', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('remark_number', models.PositiveIntegerField(blank=True, editable=False, null=True)),
('lon', models.FloatField(blank=True, null=True)),
('lat', models.FloatField(blank=True, null=True)),
('x', models.FloatField(blank=True, null=True)),
('y', models.FloatField(blank=True, null=True)),
],
options={
'ordering': ['control', 'remark_number'],
},
),
migrations.CreateModel(
name='RemarkHistory',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField(blank=True, null=True)),
('status', models.CharField(choices=[('information', 'Info'), ('to_be_processed', 'NOK'), ('processed', 'Traité'), ('validated', 'OK'), ('canceled', 'Annulé')], default='to_be_processed')),
('created_at', models.DateTimeField(auto_now_add=True)),
],
options={
'ordering': ['created_at'],
},
),
migrations.CreateModel(
name='RemarkImage',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('description', models.TextField(blank=True, null=True, verbose_name='Description du document')),
('upload_date', models.DateTimeField(auto_now=True, verbose_name='Date de téléversement')),
('status', models.CharField(choices=[('active', 'Actif'), ('archived', 'Archivé')], default='active')),
('file', models.FileField(max_length=255, storage=common.storages.PrivateMediaStorage(), upload_to='controls/remarks/', verbose_name='Fichier')),
('thumbnail', models.ImageField(blank=True, max_length=255, null=True, storage=common.storages.PrivateMediaStorage(), upload_to='controls/remarks/')),
],
options={
'ordering': ['id'],
},
),
migrations.CreateModel(
name='RemarkTag',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cat_code', models.CharField(max_length=100)),
('name_fr', models.CharField(max_length=255, verbose_name='Name FR')),
('name_nl', models.CharField(max_length=255, verbose_name='Name NL')),
('thematic', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='common.thematic')),
],
options={
'ordering': ['cat_code'],
},
),
migrations.CreateModel(
name='CheckList',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('checklist_code', models.CharField(max_length=100)),
('name_fr', models.CharField(max_length=255, verbose_name='Name FR')),
('name_nl', models.CharField(max_length=255, verbose_name='Name NL')),
('thematic', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='common.thematic')),
],
options={
'ordering': ['checklist_code'],
},
),
migrations.CreateModel(
name='CheckListControlCheck',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checklists_checks', to='controls.category')),
('checklist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checks', to='controls.checklist')),
],
),
migrations.CreateModel(
name='CheckListDocumentCheck',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('doc_type', models.CharField(choices=[('as_built', 'Plan as-built'), ('techical_sheets', 'Fiches techniques')], default='as_built')),
('checklist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='document_checks', to='controls.checklist')),
],
),
migrations.CreateModel(
name='Control',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('control_code', models.CharField(max_length=100, unique=True, verbose_name='Code du contrôle')),
('description', models.TextField(blank=True, null=True, verbose_name='Description')),
('status', models.CharField(choices=[('in_progress', 'En cours'), ('information', 'Information'), ('to_be_processed', 'A traiter'), ('processed', 'Traité'), ('validated', 'Validé'), ('canceled', 'Annulé')], default='in_progress', verbose_name='Statut')),
('control_type', models.CharField(choices=[('control', 'Contrôle'), ('site_report', 'Rapport de chantier'), ('statement', 'Constat'), ('meeting_report', 'Rapport de réunion')], default='control', verbose_name='Type de contrôle')),
('location', models.CharField(blank=True, max_length=255, null=True, verbose_name='Localisation')),
('geom', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=3812, verbose_name='Géométrie')),
('geojson', models.JSONField(blank=True, null=True, verbose_name='GeoJSON')),
('lon', models.FloatField(blank=True, null=True, verbose_name='Longitude')),
('lat', models.FloatField(blank=True, null=True, verbose_name='Latitude')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('visibility', models.CharField(choices=[('private', 'Privé'), ('intern', 'Interne'), ('all', 'Interne et externe')], default='intern', verbose_name='Visibilité')),
('shared_edition', models.BooleanField(default=False, verbose_name='Edition partagée')),
('categories', models.ManyToManyField(blank=True, related_name='controls', to='assets.assetcategory', verbose_name='Catégories')),
('control_author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='controls', to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-updated_at'],
},
),
]