-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new fields and Snapshot model for localunit (#2331)
* Add new fields in localunit and create a new model LocalUnitChangeRequest * Add migrations file for the new models and fields * Fix typo for DepricateReason * update models field for LocalUnit. * fix pre-commit --------- Co-authored-by: rup-narayan-rajbanshi <[email protected]>
- Loading branch information
1 parent
8e7f79c
commit 32d556d
Showing
3 changed files
with
194 additions
and
0 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
local_units/migrations/0018_localunit_deprecated_reason_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Generated by Django 4.2.16 on 2024-11-29 11:02 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("local_units", "0017_alter_healthdata_other_medical_heal"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="localunit", | ||
name="deprecated_reason", | ||
field=models.IntegerField( | ||
blank=True, | ||
choices=[ | ||
(1, "Non-existent local unit"), | ||
(2, "Incorrectly added local unit"), | ||
(3, "Security concerns"), | ||
(4, "Other"), | ||
], | ||
null=True, | ||
verbose_name="deprecated reason", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="localunit", | ||
name="deprecated_reason_overview", | ||
field=models.TextField(blank=True, null=True, verbose_name="Explain the reason why the local unit is being deleted"), | ||
), | ||
migrations.AddField( | ||
model_name="localunit", | ||
name="is_deprecated", | ||
field=models.BooleanField(blank=True, default=False, null=True, verbose_name="Is deprecated?"), | ||
), | ||
migrations.AddField( | ||
model_name="localunit", | ||
name="status", | ||
field=models.IntegerField( | ||
blank=True, choices=[(1, "Verified"), (2, "Unverified")], default=2, null=True, verbose_name="status" | ||
), | ||
), | ||
migrations.CreateModel( | ||
name="LocalUnitChangeRequest", | ||
fields=[ | ||
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
("previous_data", models.JSONField(default=dict, verbose_name="Previous data")), | ||
( | ||
"status", | ||
models.IntegerField( | ||
choices=[(1, "Pending"), (2, "Approved"), (3, "Revert")], default=1, verbose_name="status" | ||
), | ||
), | ||
( | ||
"current_validator", | ||
models.IntegerField( | ||
choices=[(1, "Local"), (2, "Regional"), (3, "Global")], default=1, verbose_name="Current validator" | ||
), | ||
), | ||
("triggered_at", models.DateTimeField(auto_now=True, verbose_name="Triggered at")), | ||
("updated_at", models.DateTimeField(auto_now=True, verbose_name="Updated at")), | ||
("rejected_data", models.JSONField(default=dict, verbose_name="Rejected data")), | ||
("rejected_reason", models.TextField(blank=True, null=True, verbose_name="Rejected reason")), | ||
( | ||
"local_unit", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="local_unit_change_request", | ||
to="local_units.localunit", | ||
verbose_name="Local Unit", | ||
), | ||
), | ||
( | ||
"triggered_by", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="tiggered_by_local_unit", | ||
to=settings.AUTH_USER_MODEL, | ||
verbose_name="triggered by", | ||
), | ||
), | ||
( | ||
"updated_by", | ||
models.ForeignKey( | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="updated_by_local_unit", | ||
to=settings.AUTH_USER_MODEL, | ||
verbose_name="updated by", | ||
), | ||
), | ||
], | ||
), | ||
] |
28 changes: 28 additions & 0 deletions
28
local_units/migrations/0019_alter_localunit_is_deprecated_alter_localunit_status_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.2.16 on 2024-12-02 11:26 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("local_units", "0018_localunit_deprecated_reason_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="localunit", | ||
name="is_deprecated", | ||
field=models.BooleanField(default=False, verbose_name="Is deprecated?"), | ||
), | ||
migrations.AlterField( | ||
model_name="localunit", | ||
name="status", | ||
field=models.IntegerField(choices=[(1, "Verified"), (2, "Unverified")], default=2, verbose_name="status"), | ||
), | ||
migrations.AlterField( | ||
model_name="localunitchangerequest", | ||
name="triggered_at", | ||
field=models.DateTimeField(auto_now_add=True, verbose_name="Triggered at"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters