Coverage for location / migrations / 0004_historicalmodel.py: 100%
8 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-24 12:43 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-03-24 12:43 +0000
1# Generated by Django 6.0.3 on 2026-03-10 07:29
3import django.db.models.deletion
4import django_countries.fields
5import simple_history.models
6from django.conf import settings
7from django.db import migrations, models
10class Migration(migrations.Migration):
12 dependencies = [
13 ("location", "0003_alter_model_options_alter_model_unique_together_and_more"),
14 migrations.swappable_dependency(settings.AUTH_USER_MODEL),
15 ]
17 operations = [
18 migrations.CreateModel(
19 name="HistoricalModel",
20 fields=[
21 (
22 "id",
23 models.BigIntegerField(
24 auto_created=True, blank=True, db_index=True, verbose_name="ID"
25 ),
26 ),
27 ("name", models.CharField(max_length=45)),
28 ("country", django_countries.fields.CountryField(max_length=2)),
29 ("history_id", models.AutoField(primary_key=True, serialize=False)),
30 ("history_date", models.DateTimeField(db_index=True)),
31 ("history_change_reason", models.CharField(max_length=100, null=True)),
32 (
33 "history_type",
34 models.CharField(
35 choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
36 max_length=1,
37 ),
38 ),
39 (
40 "history_user",
41 models.ForeignKey(
42 null=True,
43 on_delete=django.db.models.deletion.SET_NULL,
44 related_name="+",
45 to=settings.AUTH_USER_MODEL,
46 ),
47 ),
48 ],
49 options={
50 "verbose_name": "historical model",
51 "verbose_name_plural": "historical models",
52 "ordering": ("-history_date", "-history_id"),
53 "get_latest_by": ("history_date", "history_id"),
54 },
55 bases=(simple_history.models.HistoricalChanges, models.Model),
56 ),
57 ]