Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2960 from akvo/issue/2951-disallow-multiple-resul…
…ts-framework-children [#2951] Disallow multiple result/indicator/period children per project Code reviewed
- Loading branch information
Showing
8 changed files
with
212 additions
and
3 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
Large diffs are not rendered by default.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
def delete_duplicate_instances(apps, schema_editor): | ||
duplicate_id = 19656 | ||
Indicator = apps.get_model('rsr', 'Indicator') | ||
Indicator.objects.filter(id__in=[duplicate_id]).delete() | ||
|
||
dummy_project_id = 5701 | ||
Result = apps.get_model('rsr', 'Result') | ||
Result.objects.filter(project__id=dummy_project_id).delete() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('rsr', '0113_auto_20171116_0804'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
delete_duplicate_instances, | ||
reverse_code=lambda x, y: None | ||
), | ||
] |
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,26 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('rsr', '0114_auto_20171110_1158'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterUniqueTogether( | ||
name='indicator', | ||
unique_together=set([('result', 'parent_indicator')]), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='indicatorperiod', | ||
unique_together=set([('indicator', 'parent_period')]), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name='result', | ||
unique_together=set([('project', 'parent_result')]), | ||
), | ||
] |
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