Skip to content
This repository has been archived by the owner on Jul 18, 2023. It is now read-only.

Commit

Permalink
update old migrations and squash them to work in newer django versions
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronstephenson committed Aug 6, 2019
1 parent 6b62302 commit 9aa668b
Show file tree
Hide file tree
Showing 8 changed files with 1,373 additions and 104 deletions.
74 changes: 37 additions & 37 deletions cbrsservices/migrations/0001_initial.py

Large diffs are not rendered by default.

1,009 changes: 1,009 additions & 0 deletions cbrsservices/migrations/0001_squashed_0002_auto_20190806_1609.py

Large diffs are not rendered by default.

25 changes: 0 additions & 25 deletions cbrsservices/migrations/0002_auto_20180403_1033.py

This file was deleted.

Large diffs are not rendered by default.

88 changes: 88 additions & 0 deletions cbrsservices/migrations/0002_auto_20190806_1647.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Generated by Django 2.1.9 on 2019-08-06 16:47

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('cbrsservices', '0001_squashed_0002_auto_20190806_1609'),
]

operations = [
migrations.AddField(
model_name='historicalcase',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalcasefile',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalcasetag',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalcomment',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicaldetermination',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalfieldoffice',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalproperty',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalreportcase',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalrequester',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalsystemmap',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalsystemunit',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalsystemunitmap',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalsystemunitprohibitiondate',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicalsystemunittype',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
migrations.AddField(
model_name='historicaltag',
name='history_change_reason',
field=models.CharField(max_length=100, null=True),
),
]
Empty file.
46 changes: 22 additions & 24 deletions cbrsservices/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ class HistoryModel(models.Model):
"""

created_date = models.DateField(default=date.today, null=True, blank=True, db_index=True)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, models.PROTECT, null=True, blank=True, db_index=True,
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, null=True, blank=True, db_index=True,
related_name='%(class)s_creator')
modified_date = models.DateField(auto_now=True, null=True, blank=True)
modified_by = models.ForeignKey(settings.AUTH_USER_MODEL, models.PROTECT, null=True, blank=True, db_index=True,
modified_by = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, null=True, blank=True, db_index=True,
related_name='%(class)s_modifier')
history = HistoricalRecords()
history = HistoricalRecords(inherit=True)

class Meta:
abstract = True
Expand Down Expand Up @@ -122,28 +122,28 @@ def send_final_email(self):

case_number = property(_get_id)
case_reference = models.CharField(max_length=255, blank=True)
duplicate = models.ForeignKey('self', models.PROTECT, null=True, blank=True)
duplicate = models.ForeignKey('self', on_delete=models.PROTECT, null=True, blank=True)
status = property(_get_status)
request_date = models.DateField(default=date.today, null=True, blank=True)
requester = models.ForeignKey('Requester', models.PROTECT, related_name='cases')
property = models.ForeignKey('Property', models.PROTECT, related_name='cases')
cbrs_unit = models.ForeignKey('SystemUnit', models.PROTECT, null=True, blank=True)
map_number = models.ForeignKey('SystemMap', models.PROTECT, null=True, blank=True)
requester = models.ForeignKey('Requester', on_delete=models.PROTECT, related_name='cases')
property = models.ForeignKey('Property', on_delete=models.PROTECT, related_name='cases')
cbrs_unit = models.ForeignKey('SystemUnit', on_delete=models.PROTECT, null=True, blank=True)
map_number = models.ForeignKey('SystemMap', on_delete=models.PROTECT, null=True, blank=True)
cbrs_map_date = models.DateField(null=True, blank=True)
determination = models.ForeignKey('Determination', models.PROTECT, null=True, blank=True)
determination = models.ForeignKey('Determination', on_delete=models.PROTECT, null=True, blank=True)
prohibition_date = models.DateField(null=True, blank=True)
distance = models.FloatField(null=True, blank=True)
fws_fo_received_date = models.DateField(null=True, blank=True)
fws_hq_received_date = models.DateField(null=True, blank=True)
final_letter_date = models.DateField(null=True, blank=True)
close_date = models.DateField(null=True, blank=True)
final_letter_recipient = models.CharField(max_length=255, blank=True)
analyst = models.ForeignKey(settings.AUTH_USER_MODEL, models.PROTECT, related_name='analyst', null=True, blank=True)
analyst = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, related_name='analyst', null=True, blank=True)
analyst_signoff_date = models.DateField(null=True, blank=True)
qc_reviewer = models.ForeignKey(settings.AUTH_USER_MODEL, models.PROTECT,
qc_reviewer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT,
related_name='qc_reviewer', null=True, blank=True)
qc_reviewer_signoff_date = models.DateField(null=True, blank=True)
fws_reviewer = models.ForeignKey(settings.AUTH_USER_MODEL, models.PROTECT,
fws_reviewer = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT,
related_name='fws_reviewer', null=True, blank=True)
fws_reviewer_signoff_date = models.DateField(null=True, blank=True)
priority = models.BooleanField(default=False)
Expand Down Expand Up @@ -181,10 +181,10 @@ def casefile_location(self, instance, filename):

name = property(_get_filename)
file = models.FileField(upload_to=casefile_location)
case = models.ForeignKey('Case', models.PROTECT, related_name='casefiles')
case = models.ForeignKey('Case', on_delete=models.PROTECT, related_name='casefiles')
from_requester = models.BooleanField(default=False)
final_letter = models.BooleanField(default=False)
uploader = models.ForeignKey(settings.AUTH_USER_MODEL, models.PROTECT, null=True, blank=True,
uploader = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.PROTECT, null=True, blank=True,
related_name="casefiles")
uploaded_date = models.DateField(auto_now_add=True, null=True, blank=True)

Expand Down Expand Up @@ -247,9 +247,8 @@ class CaseTag(HistoryModel):
Table to allow many-to-many relationship between Cases and Tags.
"""

case = models.ForeignKey('Case', models.CASCADE)
tag = models.ForeignKey('Tag', models.CASCADE)
history = HistoricalRecords()
case = models.ForeignKey('Case', on_delete=models.CASCADE)
tag = models.ForeignKey('Tag', on_delete=models.CASCADE)

def __str__(self):
return str(self.case) + " - " + str(self.tag)
Expand Down Expand Up @@ -289,7 +288,7 @@ class Comment(HistoryModel):
"""

comment = models.TextField()
acase = models.ForeignKey('Case', models.CASCADE, related_name='comments')
acase = models.ForeignKey('Case', on_delete=models.CASCADE, related_name='comments')

def __str__(self):
return self.comment
Expand Down Expand Up @@ -331,8 +330,8 @@ class SystemUnit(HistoryModel):

system_unit_number = models.CharField(max_length=16, unique=True)
system_unit_name = models.CharField(max_length=255, blank=True)
system_unit_type = models.ForeignKey('SystemUnitType', models.PROTECT)
field_office = models.ForeignKey('FieldOffice', models.PROTECT, related_name='system_units', null=True, blank=True)
system_unit_type = models.ForeignKey('SystemUnitType', on_delete=models.PROTECT)
field_office = models.ForeignKey('FieldOffice', on_delete=models.PROTECT, related_name='system_units', null=True, blank=True)
system_maps = models.ManyToManyField('SystemMap', through='SystemUnitMap', related_name='system_units')

def __str__(self):
Expand Down Expand Up @@ -364,7 +363,7 @@ class SystemUnitProhibitionDate(HistoryModel):
"""

prohibition_date = models.DateField()
system_unit = models.ForeignKey('SystemUnit', models.CASCADE, related_name='prohibition_dates')
system_unit = models.ForeignKey('SystemUnit', on_delete=models.CASCADE, related_name='prohibition_dates')

def __str__(self):
return self.prohibition_date
Expand All @@ -380,9 +379,8 @@ class SystemUnitMap(HistoryModel):
Table to allow many-to-many relationship between System Units and Maps.
"""

system_unit = models.ForeignKey('SystemUnit', models.CASCADE)
system_map = models.ForeignKey('SystemMap', models.CASCADE)
history = HistoricalRecords()
system_unit = models.ForeignKey('SystemUnit', on_delete=models.CASCADE)
system_map = models.ForeignKey('SystemMap', on_delete=models.CASCADE)

def __str__(self):
return str(self.system_unit) + " - " + str(self.system_map)
Expand Down
2 changes: 1 addition & 1 deletion cbrsservices_django/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@

urlpatterns = [
url('media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT, }),
url(r'^cbrsservices/', include(('cbrsservices.urls', 'cbrsservices_django'), namespace="cbrsservices_django")),
url(r'^cbrsservices/', include('cbrsservices.urls')),
]

0 comments on commit 9aa668b

Please sign in to comment.