This repository has been archived by the owner on Jul 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change ReportType and Status from hard coded choice fields to stand-a…
…lone models with API endpoints
- Loading branch information
1 parent
b50ae79
commit 958e7a8
Showing
9 changed files
with
231 additions
and
45 deletions.
There are no files selected for viewing
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
90 changes: 90 additions & 0 deletions
90
lideservices/migrations/0011_historicalreporttype_historicalstatus_reporttype_status.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,90 @@ | ||
# Generated by Django 2.2 on 2019-10-11 11:26 | ||
|
||
import datetime | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import simple_history.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('lideservices', '0010_auto_20191008_2214'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Status', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_date', models.DateField(blank=True, db_index=True, default=datetime.date.today, null=True)), | ||
('modified_date', models.DateField(auto_now=True, null=True)), | ||
('name', models.CharField(max_length=128, unique=True)), | ||
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='status_creator', to=settings.AUTH_USER_MODEL)), | ||
('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='status_modifier', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'db_table': 'lide_status', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='ReportType', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('created_date', models.DateField(blank=True, db_index=True, default=datetime.date.today, null=True)), | ||
('modified_date', models.DateField(auto_now=True, null=True)), | ||
('name', models.CharField(max_length=128, unique=True)), | ||
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='reporttype_creator', to=settings.AUTH_USER_MODEL)), | ||
('modified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='reporttype_modifier', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'db_table': 'lide_reporttype', | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name='HistoricalStatus', | ||
fields=[ | ||
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), | ||
('created_date', models.DateField(blank=True, db_index=True, default=datetime.date.today, null=True)), | ||
('modified_date', models.DateField(blank=True, editable=False, null=True)), | ||
('name', models.CharField(db_index=True, max_length=128)), | ||
('history_id', models.AutoField(primary_key=True, serialize=False)), | ||
('history_date', models.DateTimeField()), | ||
('history_change_reason', models.CharField(max_length=100, null=True)), | ||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), | ||
('created_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
('modified_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'verbose_name': 'historical status', | ||
'ordering': ('-history_date', '-history_id'), | ||
'get_latest_by': 'history_date', | ||
}, | ||
bases=(simple_history.models.HistoricalChanges, models.Model), | ||
), | ||
migrations.CreateModel( | ||
name='HistoricalReportType', | ||
fields=[ | ||
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')), | ||
('created_date', models.DateField(blank=True, db_index=True, default=datetime.date.today, null=True)), | ||
('modified_date', models.DateField(blank=True, editable=False, null=True)), | ||
('name', models.CharField(db_index=True, max_length=128)), | ||
('history_id', models.AutoField(primary_key=True, serialize=False)), | ||
('history_date', models.DateTimeField()), | ||
('history_change_reason', models.CharField(max_length=100, null=True)), | ||
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)), | ||
('created_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
('modified_by', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'verbose_name': 'historical report type', | ||
'ordering': ('-history_date', '-history_id'), | ||
'get_latest_by': 'history_date', | ||
}, | ||
bases=(simple_history.models.HistoricalChanges, models.Model), | ||
), | ||
] |
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,34 @@ | ||
# Generated by Django 2.2 on 2019-10-11 11:30 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lideservices', '0011_historicalreporttype_historicalstatus_reporttype_status'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='historicalreportfile', | ||
name='report_status', | ||
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='lideservices.Status'), | ||
), | ||
migrations.AlterField( | ||
model_name='historicalreportfile', | ||
name='report_type', | ||
field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='lideservices.ReportType'), | ||
), | ||
migrations.AlterField( | ||
model_name='reportfile', | ||
name='report_status', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='reportfiles', to='lideservices.Status'), | ||
), | ||
migrations.AlterField( | ||
model_name='reportfile', | ||
name='report_type', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='reportfiles', to='lideservices.ReportType'), | ||
), | ||
] |
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,23 @@ | ||
# Generated by Django 2.2 on 2019-10-11 11:39 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('lideservices', '0012_auto_20191011_1130'), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name='historicalreportfile', | ||
old_name='report_status', | ||
new_name='status', | ||
), | ||
migrations.RenameField( | ||
model_name='reportfile', | ||
old_name='report_status', | ||
new_name='status', | ||
), | ||
] |
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
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
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
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
Oops, something went wrong.