-
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove TestPlanText model, use TestPlan.text instead
Now that we have proper history tracking we don't need a separate model to hold versions of the text. Instead this can be a field inside TestPlan model. - remove unused showMoreSummary() and showShortSummary() JavaScript functions - remove now unnecessary clone_form.copy_texts ption - simplify plan/get_docs.html template and merge with plan/get.html - remove TestPlan.latest_text() and TestPlan.add_text() methods, refs #198
- Loading branch information
Showing
16 changed files
with
94 additions
and
166 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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Generated by Django 2.0.7 on 2018-07-07 21:07 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def forward_copy_data(apps, schema_editor): | ||
TestPlan = apps.get_model('testplans', 'TestPlan') | ||
TestPlanText = apps.get_model('testplans', 'TestPlanText') | ||
|
||
for test_plan in TestPlan.objects.all(): | ||
latest_text = TestPlanText.objects.filter(plan=test_plan.pk).order_by('-pk').first() | ||
if latest_text: | ||
test_plan.plan_text = latest_text.plan_text | ||
test_plan.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('testplans', '0016_historicaltestplan'), | ||
] | ||
|
||
operations = [ | ||
# add new field to hold TP text but use a temporary name | ||
# b/c `text` is also the name of the pre-existing reverse relationship | ||
migrations.AddField( | ||
model_name='historicaltestplan', | ||
name='plan_text', | ||
field=models.TextField(blank=True), | ||
), | ||
migrations.AddField( | ||
model_name='testplan', | ||
name='plan_text', | ||
field=models.TextField(blank=True), | ||
), | ||
|
||
# copy the data from the related model | ||
migrations.RunPython(forward_copy_data), | ||
|
||
# remove the related model | ||
migrations.RemoveField( | ||
model_name='testplantext', | ||
name='author', | ||
), | ||
migrations.RemoveField( | ||
model_name='testplantext', | ||
name='plan', | ||
), | ||
migrations.DeleteModel( | ||
name='TestPlanText', | ||
), | ||
|
||
# rename the new field to what is inside the model source | ||
migrations.RenameField( | ||
model_name='historicaltestplan', | ||
old_name='plan_text', | ||
new_name='text', | ||
), | ||
migrations.RenameField( | ||
model_name='testplan', | ||
old_name='plan_text', | ||
new_name='text', | ||
), | ||
] |
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.