-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[#2189] Move to IATI statuses
- Loading branch information
Showing
32 changed files
with
301 additions
and
132 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 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,22 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
import akvo.rsr.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
# ('rsr', '0070_auto_20160519_1205'), | ||
('rsr', '0074_auto_20160526_0938'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='project', | ||
name='iati_status', | ||
field=akvo.rsr.fields.ValidXMLCharField(default=b'0', choices=[('0', ''), ('1', '1 - Pipeline/identification'), ('2', '2 - Implementation'), ('3', '3 - Completion'), ('4', '4 - Post-completion'), ('5', '5 - Cancelled'), ('6', '6 - Suspended')], max_length=1, help_text='There are six different project statuses:<br/>1) Pipeline/identification: the project is being scoped or planned<br/>2) Implementation: the project is currently being implemented<br/>3) Completion: the project is complete or the final disbursement has been made<br/>4) Post-completion: the project is complete or the final disbursement has been made, but the project remains open pending financial sign off or M&E<br/>5) Cancelled: the project has been cancelled<br/>6) Suspended: the project has been temporarily suspended or the reporting partner no longer uses RSR.', verbose_name='status', db_index=True), | ||
preserve_default=True, | ||
), | ||
] |
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,39 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
# convert old rsr statuses to equivalent iati status codes | ||
# # see http://iatistandard.org/202/codelists/ActivityStatus/ | ||
STATUS_TO_CODE = { | ||
'N': '0', | ||
'H': '1', | ||
'A': '2', | ||
'C': '3', | ||
'L': '5', | ||
'R': '6', | ||
} | ||
|
||
# update new field with existing values | ||
def populate_iati_status(apps, schema_editor): | ||
Project = apps.get_model('rsr', 'Project') | ||
for p in Project.objects.all(): | ||
p.iati_status = STATUS_TO_CODE[p.status] | ||
p.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('rsr', '0075_auto_20160525_1006'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(populate_iati_status, populate_iati_status), | ||
migrations.RunSQL("UPDATE rsr_projecteditorvalidation SET validation = 'rsr_project.iati_status' " | ||
"WHERE validation = 'rsr_project.status';", | ||
"UPDATE rsr_projecteditorvalidation SET validation = 'rsr_project.status' " | ||
"WHERE validation = 'rsr_project.iati_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
Oops, something went wrong.