diff --git a/akvo/iati/exports/elements/activity_status.py b/akvo/iati/exports/elements/activity_status.py
index 71b05a7dac..6041e6290f 100644
--- a/akvo/iati/exports/elements/activity_status.py
+++ b/akvo/iati/exports/elements/activity_status.py
@@ -6,15 +6,6 @@
from lxml import etree
-STATUS_TO_CODE = {
- 'N': '0',
- 'H': '1',
- 'A': '2',
- 'C': '3',
- 'L': '5',
- 'R': '6',
-}
-
def activity_status(project):
"""
diff --git a/akvo/iati/imports/mappers/defaults.py b/akvo/iati/imports/mappers/defaults.py
index 08ce9e3aae..fc83210c3d 100644
--- a/akvo/iati/imports/mappers/defaults.py
+++ b/akvo/iati/imports/mappers/defaults.py
@@ -4,20 +4,10 @@
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
-from akvo.rsr.models.project import Project
from akvo.rsr.models.project_condition import ProjectCondition
from .. import ImportMapper, xml_ns
-CODE_TO_STATUS = {
- '1': 'H',
- '2': 'A',
- '3': 'C',
- '4': 'C',
- '5': 'L',
- '6': 'R'
-}
-
class Language(ImportMapper):
@@ -183,7 +173,7 @@ def do_import(self):
if not iati_status:
self.add_log('activity-status@code', 'iati_status', 'invalid status code')
- iati_status = '0'
+ iati_status = ''
return self.update_project_field('iati_status', iati_status)
diff --git a/akvo/rsr/migrations/0075_auto_20160525_1006.py b/akvo/rsr/migrations/0075_auto_20160525_1006.py
index 75a6e99cb1..1ad7f8c5e3 100644
--- a/akvo/rsr/migrations/0075_auto_20160525_1006.py
+++ b/akvo/rsr/migrations/0075_auto_20160525_1006.py
@@ -8,7 +8,6 @@
class Migration(migrations.Migration):
dependencies = [
- # ('rsr', '0070_auto_20160519_1205'),
('rsr', '0074_auto_20160526_0938'),
]
@@ -16,7 +15,7 @@ class Migration(migrations.Migration):
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:
1) Pipeline/identification: the project is being scoped or planned
2) Implementation: the project is currently being implemented
3) Completion: the project is complete or the final disbursement has been made
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
5) Cancelled: the project has been cancelled
6) Suspended: the project has been temporarily suspended or the reporting partner no longer uses RSR.', verbose_name='status', db_index=True),
+ field=akvo.rsr.fields.ValidXMLCharField(blank=True, choices=[('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:
1) Pipeline/identification: the project is being scoped or planned
2) Implementation: the project is currently being implemented
3) Completion: the project is complete or the final disbursement has been made
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
5) Cancelled: the project has been cancelled
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,
),
]
diff --git a/akvo/rsr/migrations/0076_auto_20160525_1008.py b/akvo/rsr/migrations/0076_auto_20160525_1008.py
index 3d33047c8b..08d8ac106e 100644
--- a/akvo/rsr/migrations/0076_auto_20160525_1008.py
+++ b/akvo/rsr/migrations/0076_auto_20160525_1008.py
@@ -4,23 +4,99 @@
from django.db import models, migrations
-# convert old rsr statuses to equivalent iati status codes
-# # see http://iatistandard.org/202/codelists/ActivityStatus/
+# Convert old rsr statuses to equivalent iati status codes
+# See http://iatistandard.org/202/codelists/ActivityStatus/
STATUS_TO_CODE = {
- 'N': '0',
+ 'N': '',
'H': '1',
'A': '2',
'C': '3',
'L': '5',
- 'R': '6',
+ 'R': '3'
}
-# update new field with existing values
+# Some 'Archived' projects should be mapped to either 'None' or 'Cancelled'.
+# Otherwise, 'Archived' projects use the regular mapping (to 'Completion').
+SPECIAL_ARCHIVED_MAPPING = {
+ 18: '5',
+ 31: '',
+ 33: '',
+ 34: '',
+ 35: '',
+ 37: '',
+ 44: '5',
+ 45: '5',
+ 52: '5',
+ 66: '',
+ 81: '5',
+ 83: '5',
+ 84: '5',
+ 85: '5',
+ 86: '5',
+ 87: '5',
+ 88: '5',
+ 89: '5',
+ 90: '5',
+ 91: '5',
+ 92: '5',
+ 93: '5',
+ 95: '5',
+ 96: '5',
+ 97: '5',
+ 98: '5',
+ 99: '5',
+ 100: '5',
+ 103: '5',
+ 109: '5',
+ 110: '5',
+ 111: '5',
+ 114: '5',
+ 117: '5',
+ 118: '5',
+ 119: '',
+ 122: '5',
+ 123: '5',
+ 124: '5',
+ 125: '5',
+ 126: '5',
+ 127: '5',
+ 132: '',
+ 144: '5',
+ 156: '',
+ 159: '',
+ 160: '',
+ 173: '',
+ 176: '',
+ 177: '5',
+ 200: '5',
+ 234: '',
+ 271: '5',
+ 279: '',
+ 280: '',
+ 281: '',
+ 283: '',
+ 455: '',
+ 308: '',
+ 309: '',
+ 1010: '',
+}
+
+
def populate_iati_status(apps, schema_editor):
+ """
+ Update new field with existing values. If a project is mentioned in the special mapping and
+ this project has the status 'Archived' (this is a double-check), then use the special mapping.
+
+ Otherwise, the regular mapping of STATUS_TO_CODE is applied.
+ """
Project = apps.get_model('rsr', 'Project')
for p in Project.objects.all():
- p.iati_status = STATUS_TO_CODE[p.status]
- p.save()
+ if p.id in SPECIAL_ARCHIVED_MAPPING.keys() and p.status == 'R':
+ p.iati_status = SPECIAL_ARCHIVED_MAPPING[p.id]
+ p.save()
+ else:
+ p.iati_status = STATUS_TO_CODE[p.status]
+ p.save()
class Migration(migrations.Migration):
@@ -31,9 +107,10 @@ class Migration(migrations.Migration):
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';"
- )
+ 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';"
+ )
]
diff --git a/akvo/rsr/migrations/0077_auto_20160608_1227.py b/akvo/rsr/migrations/0077_auto_20160608_1227.py
new file mode 100644
index 0000000000..46882b7f77
--- /dev/null
+++ b/akvo/rsr/migrations/0077_auto_20160608_1227.py
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import akvo.rsr.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('rsr', '0076_auto_20160525_1008'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='iatiimport',
+ name='mapper_prefix',
+ field=models.CharField(blank=True, help_text=b'Choose a custom mapper to invoke custom behaviour for this import', max_length=30, verbose_name='Custom mappers', choices=[(b'CordaidZip', b'CordaidZip'), (b'Cordaid', b'Cordaid'), (b'ICCO', b'ICCO')]),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='molliegateway',
+ name='currency',
+ field=akvo.rsr.fields.ValidXMLCharField(default=b'EUR', max_length=3, choices=[('AED', 'AED - UAE Dirham'), ('AFN', 'AFN - Afghani'), ('ALL', 'ALL - Lek'), ('AMD', 'AMD - Armenian Dram'), ('ANG', 'ANG - Netherlands Antillian Guilder'), ('AOA', 'AOA - Kwanza'), ('ARS', 'ARS - Argentine Peso'), ('AUD', 'AUD - Australian Dollar'), ('AWG', 'AWG - Aruban Guilder'), ('AZN', 'AZN - Azerbaijanian Manat'), ('BAM', 'BAM - Convertible Marks'), ('BBD', 'BBD - Barbados Dollar'), ('BDT', 'BDT - Taka'), ('BGN', 'BGN - Bulgarian Lev'), ('BHD', 'BHD - Bahraini Dinar'), ('BIF', 'BIF - Burundi Franc'), ('BMD', 'BMD - Bermudian Dollar'), ('BND', 'BND - Brunei Dollar'), ('BOB', 'BOB - Boliviano'), ('BOV', 'BOV - Mvdol'), ('BRL', 'BRL - Brazilian Real'), ('BSD', 'BSD - Bahamian Dollar'), ('BTN', 'BTN - Ngultrum'), ('BWP', 'BWP - Pula'), ('BYR', 'BYR - Belarussian Ruble'), ('BZD', 'BZD - Belize Dollar'), ('CAD', 'CAD - Canadian Dollar'), ('CDF', 'CDF - Congolese Franc'), ('CHF', 'CHF - Swiss Franc'), ('CLF', 'CLF - Unidades de fomento'), ('CLP', 'CLP - Chilean Peso'), ('CNY', 'CNY - Yuan Renminbi'), ('COP', 'COP - Colombian Peso'), ('COU', 'COU - Unidad de Valor Real'), ('CRC', 'CRC - Costa Rican Colon'), ('CUC', 'CUC - Peso Convertible'), ('CUP', 'CUP - Cuban Peso'), ('CVE', 'CVE - Cape Verde Escudo'), ('CZK', 'CZK - Czech Koruna'), ('DJF', 'DJF - Djibouti Franc'), ('DKK', 'DKK - Danish Krone'), ('DOP', 'DOP - Dominican Peso'), ('DZD', 'DZD - Algerian Dinar'), ('EEK', 'EEK - Kroon'), ('EGP', 'EGP - Egyptian Pound'), ('ERN', 'ERN - Nakfa'), ('ETB', 'ETB - Ethiopian Birr'), ('EUR', 'EUR - Euro'), ('FJD', 'FJD - Fiji Dollar'), ('FKP', 'FKP - Falkland Islands Pound'), ('GBP', 'GBP - Pound Sterling'), ('GEL', 'GEL - Lari'), ('GHS', 'GHS - Cedi'), ('GIP', 'GIP - Gibraltar Pound'), ('GMD', 'GMD - Dalasi'), ('GNF', 'GNF - Guinea Franc'), ('GTQ', 'GTQ - Quetzal'), ('GYD', 'GYD - Guyana Dollar'), ('HKD', 'HKD - Hong Kong Dollar'), ('HNL', 'HNL - Lempira'), ('HRK', 'HRK - Kuna'), ('HTG', 'HTG - Gourde'), ('HUF', 'HUF - Forint'), ('IDR', 'IDR - Rupiah'), ('ILS', 'ILS - New Israeli Sheqel'), ('INR', 'INR - Indian Rupee'), ('IQD', 'IQD - Iraqi Dinar'), ('IRR', 'IRR - Iranian Rial'), ('ISK', 'ISK - Iceland Krona'), ('JMD', 'JMD - Jamaican Dollar'), ('JOD', 'JOD - Jordanian Dinar'), ('JPY', 'JPY - Yen'), ('KES', 'KES - Kenyan Shilling'), ('KGS', 'KGS - Som'), ('KHR', 'KHR - Riel'), ('KMF', 'KMF - Comoro Franc'), ('KPW', 'KPW - North Korean Won'), ('KRW', 'KRW - Won'), ('KWD', 'KWD - Kuwaiti Dinar'), ('KYD', 'KYD - Cayman Islands Dollar'), ('KZT', 'KZT - Tenge'), ('LAK', 'LAK - Kip'), ('LBP', 'LBP - Lebanese Pound'), ('LKR', 'LKR - Sri Lanka Rupee'), ('LRD', 'LRD - Liberian Dollar'), ('LSL', 'LSL - Loti'), ('LTL', 'LTL - Lithuanian Litas'), ('LVL', 'LVL - Latvian Lats'), ('LYD', 'LYD - Libyan Dinar'), ('MAD', 'MAD - Moroccan Dirham'), ('MDL', 'MDL - Moldovan Leu'), ('MGA', 'MGA - Malagasy Ariary'), ('MKD', 'MKD - Denar'), ('MMK', 'MMK - Kyat'), ('MNT', 'MNT - Tugrik'), ('MOP', 'MOP - Pataca'), ('MRO', 'MRO - Ouguiya'), ('MUR', 'MUR - Mauritius Rupee'), ('MVR', 'MVR - Rufiyaa'), ('MWK', 'MWK - Malawi Kwacha'), ('MXN', 'MXN - Mexican Peso'), ('MXV', 'MXV - Mexican Unidad de Inversion (UDI)'), ('MYR', 'MYR - Malaysian Ringgit'), ('MZN', 'MZN - Metical'), ('NAD', 'NAD - Namibia Dollar'), ('NGN', 'NGN - Naira'), ('NIO', 'NIO - Cordoba Oro'), ('NOK', 'NOK - Norwegian Krone'), ('NPR', 'NPR - Nepalese Rupee'), ('NZD', 'NZD - New Zealand Dollar'), ('OMR', 'OMR - Rial Omani'), ('PAB', 'PAB - Balboa'), ('PEN', 'PEN - Nuevo Sol'), ('PGK', 'PGK - Kina'), ('PHP', 'PHP - Philippine Peso'), ('PKR', 'PKR - Pakistan Rupee'), ('PLN', 'PLN - Zloty'), ('PYG', 'PYG - Guarani'), ('QAR', 'QAR - Qatari Rial'), ('RON', 'RON - Romanian Leu'), ('RSD', 'RSD - Serbian Dinar'), ('RUB', 'RUB - Russian Ruble'), ('RWF', 'RWF - Rwanda Franc'), ('SAR', 'SAR - Saudi Riyal'), ('SBD', 'SBD - Solomon Islands Dollar'), ('SCR', 'SCR - Seychelles Rupee'), ('SDG', 'SDG - Sudanese Pound'), ('SEK', 'SEK - Swedish Krona'), ('SGD', 'SGD - Singapore Dollar'), ('SHP', 'SHP - Saint Helena Pound'), ('SLL', 'SLL - Leone'), ('SOS', 'SOS - Somali Shilling'), ('SSP', 'SSP - South Sudanese Pound'), ('SRD', 'SRD - Surinam Dollar'), ('STD', 'STD - Dobra'), ('SVC', 'SVC - El Salvador Colon'), ('SYP', 'SYP - Syrian Pound'), ('SZL', 'SZL - Lilangeni'), ('THB', 'THB - Baht'), ('TJS', 'TJS - Somoni'), ('TMT', 'TMT - Manat'), ('TND', 'TND - Tunisian Dinar'), ('TOP', 'TOP - Paanga'), ('TRY', 'TRY - Turkish Lira'), ('TTD', 'TTD - Trinidad and Tobago Dollar'), ('TWD', 'TWD - New Taiwan Dollar'), ('TZS', 'TZS - Tanzanian Shilling'), ('UAH', 'UAH - Hryvnia'), ('UGX', 'UGX - Uganda Shilling'), ('USD', 'USD - US Dollar'), ('USN', 'USN - US Dollar (Next day)'), ('USS', 'USS - US Dollar (Same day)'), ('UYI', 'UYI - Uruguay Peso en Unidades Indexadas'), ('UYU', 'UYU - Peso Uruguayo'), ('UZS', 'UZS - Uzbekistan Sum'), ('VEF', 'VEF - Bolivar'), ('VND', 'VND - Dong'), ('VUV', 'VUV - Vatu'), ('WST', 'WST - Tala'), ('XAF', 'XAF - CFA Franc BEAC'), ('XBT', 'XBT - Bitcoin'), ('XCD', 'XCD - East Caribbean Dollar'), ('XDR', 'XDR - International Monetary Fund (IMF) Special Drawing Right (SDR)'), ('XOF', 'XOF - CFA Franc BCEAO'), ('XPF', 'XPF - CFP Franc'), ('YER', 'YER - Yemeni Rial'), ('ZAR', 'ZAR - Rand'), ('ZMK', 'ZMK - Zambian Kwacha'), ('ZWL', 'ZWL - Zimbabwe Dollar')]),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='paypalgateway',
+ name='currency',
+ field=akvo.rsr.fields.ValidXMLCharField(default=b'EUR', max_length=3, choices=[('AED', 'AED - UAE Dirham'), ('AFN', 'AFN - Afghani'), ('ALL', 'ALL - Lek'), ('AMD', 'AMD - Armenian Dram'), ('ANG', 'ANG - Netherlands Antillian Guilder'), ('AOA', 'AOA - Kwanza'), ('ARS', 'ARS - Argentine Peso'), ('AUD', 'AUD - Australian Dollar'), ('AWG', 'AWG - Aruban Guilder'), ('AZN', 'AZN - Azerbaijanian Manat'), ('BAM', 'BAM - Convertible Marks'), ('BBD', 'BBD - Barbados Dollar'), ('BDT', 'BDT - Taka'), ('BGN', 'BGN - Bulgarian Lev'), ('BHD', 'BHD - Bahraini Dinar'), ('BIF', 'BIF - Burundi Franc'), ('BMD', 'BMD - Bermudian Dollar'), ('BND', 'BND - Brunei Dollar'), ('BOB', 'BOB - Boliviano'), ('BOV', 'BOV - Mvdol'), ('BRL', 'BRL - Brazilian Real'), ('BSD', 'BSD - Bahamian Dollar'), ('BTN', 'BTN - Ngultrum'), ('BWP', 'BWP - Pula'), ('BYR', 'BYR - Belarussian Ruble'), ('BZD', 'BZD - Belize Dollar'), ('CAD', 'CAD - Canadian Dollar'), ('CDF', 'CDF - Congolese Franc'), ('CHF', 'CHF - Swiss Franc'), ('CLF', 'CLF - Unidades de fomento'), ('CLP', 'CLP - Chilean Peso'), ('CNY', 'CNY - Yuan Renminbi'), ('COP', 'COP - Colombian Peso'), ('COU', 'COU - Unidad de Valor Real'), ('CRC', 'CRC - Costa Rican Colon'), ('CUC', 'CUC - Peso Convertible'), ('CUP', 'CUP - Cuban Peso'), ('CVE', 'CVE - Cape Verde Escudo'), ('CZK', 'CZK - Czech Koruna'), ('DJF', 'DJF - Djibouti Franc'), ('DKK', 'DKK - Danish Krone'), ('DOP', 'DOP - Dominican Peso'), ('DZD', 'DZD - Algerian Dinar'), ('EEK', 'EEK - Kroon'), ('EGP', 'EGP - Egyptian Pound'), ('ERN', 'ERN - Nakfa'), ('ETB', 'ETB - Ethiopian Birr'), ('EUR', 'EUR - Euro'), ('FJD', 'FJD - Fiji Dollar'), ('FKP', 'FKP - Falkland Islands Pound'), ('GBP', 'GBP - Pound Sterling'), ('GEL', 'GEL - Lari'), ('GHS', 'GHS - Cedi'), ('GIP', 'GIP - Gibraltar Pound'), ('GMD', 'GMD - Dalasi'), ('GNF', 'GNF - Guinea Franc'), ('GTQ', 'GTQ - Quetzal'), ('GYD', 'GYD - Guyana Dollar'), ('HKD', 'HKD - Hong Kong Dollar'), ('HNL', 'HNL - Lempira'), ('HRK', 'HRK - Kuna'), ('HTG', 'HTG - Gourde'), ('HUF', 'HUF - Forint'), ('IDR', 'IDR - Rupiah'), ('ILS', 'ILS - New Israeli Sheqel'), ('INR', 'INR - Indian Rupee'), ('IQD', 'IQD - Iraqi Dinar'), ('IRR', 'IRR - Iranian Rial'), ('ISK', 'ISK - Iceland Krona'), ('JMD', 'JMD - Jamaican Dollar'), ('JOD', 'JOD - Jordanian Dinar'), ('JPY', 'JPY - Yen'), ('KES', 'KES - Kenyan Shilling'), ('KGS', 'KGS - Som'), ('KHR', 'KHR - Riel'), ('KMF', 'KMF - Comoro Franc'), ('KPW', 'KPW - North Korean Won'), ('KRW', 'KRW - Won'), ('KWD', 'KWD - Kuwaiti Dinar'), ('KYD', 'KYD - Cayman Islands Dollar'), ('KZT', 'KZT - Tenge'), ('LAK', 'LAK - Kip'), ('LBP', 'LBP - Lebanese Pound'), ('LKR', 'LKR - Sri Lanka Rupee'), ('LRD', 'LRD - Liberian Dollar'), ('LSL', 'LSL - Loti'), ('LTL', 'LTL - Lithuanian Litas'), ('LVL', 'LVL - Latvian Lats'), ('LYD', 'LYD - Libyan Dinar'), ('MAD', 'MAD - Moroccan Dirham'), ('MDL', 'MDL - Moldovan Leu'), ('MGA', 'MGA - Malagasy Ariary'), ('MKD', 'MKD - Denar'), ('MMK', 'MMK - Kyat'), ('MNT', 'MNT - Tugrik'), ('MOP', 'MOP - Pataca'), ('MRO', 'MRO - Ouguiya'), ('MUR', 'MUR - Mauritius Rupee'), ('MVR', 'MVR - Rufiyaa'), ('MWK', 'MWK - Malawi Kwacha'), ('MXN', 'MXN - Mexican Peso'), ('MXV', 'MXV - Mexican Unidad de Inversion (UDI)'), ('MYR', 'MYR - Malaysian Ringgit'), ('MZN', 'MZN - Metical'), ('NAD', 'NAD - Namibia Dollar'), ('NGN', 'NGN - Naira'), ('NIO', 'NIO - Cordoba Oro'), ('NOK', 'NOK - Norwegian Krone'), ('NPR', 'NPR - Nepalese Rupee'), ('NZD', 'NZD - New Zealand Dollar'), ('OMR', 'OMR - Rial Omani'), ('PAB', 'PAB - Balboa'), ('PEN', 'PEN - Nuevo Sol'), ('PGK', 'PGK - Kina'), ('PHP', 'PHP - Philippine Peso'), ('PKR', 'PKR - Pakistan Rupee'), ('PLN', 'PLN - Zloty'), ('PYG', 'PYG - Guarani'), ('QAR', 'QAR - Qatari Rial'), ('RON', 'RON - Romanian Leu'), ('RSD', 'RSD - Serbian Dinar'), ('RUB', 'RUB - Russian Ruble'), ('RWF', 'RWF - Rwanda Franc'), ('SAR', 'SAR - Saudi Riyal'), ('SBD', 'SBD - Solomon Islands Dollar'), ('SCR', 'SCR - Seychelles Rupee'), ('SDG', 'SDG - Sudanese Pound'), ('SEK', 'SEK - Swedish Krona'), ('SGD', 'SGD - Singapore Dollar'), ('SHP', 'SHP - Saint Helena Pound'), ('SLL', 'SLL - Leone'), ('SOS', 'SOS - Somali Shilling'), ('SSP', 'SSP - South Sudanese Pound'), ('SRD', 'SRD - Surinam Dollar'), ('STD', 'STD - Dobra'), ('SVC', 'SVC - El Salvador Colon'), ('SYP', 'SYP - Syrian Pound'), ('SZL', 'SZL - Lilangeni'), ('THB', 'THB - Baht'), ('TJS', 'TJS - Somoni'), ('TMT', 'TMT - Manat'), ('TND', 'TND - Tunisian Dinar'), ('TOP', 'TOP - Paanga'), ('TRY', 'TRY - Turkish Lira'), ('TTD', 'TTD - Trinidad and Tobago Dollar'), ('TWD', 'TWD - New Taiwan Dollar'), ('TZS', 'TZS - Tanzanian Shilling'), ('UAH', 'UAH - Hryvnia'), ('UGX', 'UGX - Uganda Shilling'), ('USD', 'USD - US Dollar'), ('USN', 'USN - US Dollar (Next day)'), ('USS', 'USS - US Dollar (Same day)'), ('UYI', 'UYI - Uruguay Peso en Unidades Indexadas'), ('UYU', 'UYU - Peso Uruguayo'), ('UZS', 'UZS - Uzbekistan Sum'), ('VEF', 'VEF - Bolivar'), ('VND', 'VND - Dong'), ('VUV', 'VUV - Vatu'), ('WST', 'WST - Tala'), ('XAF', 'XAF - CFA Franc BEAC'), ('XBT', 'XBT - Bitcoin'), ('XCD', 'XCD - East Caribbean Dollar'), ('XDR', 'XDR - International Monetary Fund (IMF) Special Drawing Right (SDR)'), ('XOF', 'XOF - CFA Franc BCEAO'), ('XPF', 'XPF - CFP Franc'), ('YER', 'YER - Yemeni Rial'), ('ZAR', 'ZAR - Rand'), ('ZMK', 'ZMK - Zambian Kwacha'), ('ZWL', 'ZWL - Zimbabwe Dollar')]),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='project',
+ name='currency',
+ field=akvo.rsr.fields.ValidXMLCharField(default=b'EUR', help_text='The default currency for this project. Used in all financial aspects of the project.', max_length=3, verbose_name='currency', choices=[('AED', 'AED - UAE Dirham'), ('AFN', 'AFN - Afghani'), ('ALL', 'ALL - Lek'), ('AMD', 'AMD - Armenian Dram'), ('ANG', 'ANG - Netherlands Antillian Guilder'), ('AOA', 'AOA - Kwanza'), ('ARS', 'ARS - Argentine Peso'), ('AUD', 'AUD - Australian Dollar'), ('AWG', 'AWG - Aruban Guilder'), ('AZN', 'AZN - Azerbaijanian Manat'), ('BAM', 'BAM - Convertible Marks'), ('BBD', 'BBD - Barbados Dollar'), ('BDT', 'BDT - Taka'), ('BGN', 'BGN - Bulgarian Lev'), ('BHD', 'BHD - Bahraini Dinar'), ('BIF', 'BIF - Burundi Franc'), ('BMD', 'BMD - Bermudian Dollar'), ('BND', 'BND - Brunei Dollar'), ('BOB', 'BOB - Boliviano'), ('BOV', 'BOV - Mvdol'), ('BRL', 'BRL - Brazilian Real'), ('BSD', 'BSD - Bahamian Dollar'), ('BTN', 'BTN - Ngultrum'), ('BWP', 'BWP - Pula'), ('BYR', 'BYR - Belarussian Ruble'), ('BZD', 'BZD - Belize Dollar'), ('CAD', 'CAD - Canadian Dollar'), ('CDF', 'CDF - Congolese Franc'), ('CHF', 'CHF - Swiss Franc'), ('CLF', 'CLF - Unidades de fomento'), ('CLP', 'CLP - Chilean Peso'), ('CNY', 'CNY - Yuan Renminbi'), ('COP', 'COP - Colombian Peso'), ('COU', 'COU - Unidad de Valor Real'), ('CRC', 'CRC - Costa Rican Colon'), ('CUC', 'CUC - Peso Convertible'), ('CUP', 'CUP - Cuban Peso'), ('CVE', 'CVE - Cape Verde Escudo'), ('CZK', 'CZK - Czech Koruna'), ('DJF', 'DJF - Djibouti Franc'), ('DKK', 'DKK - Danish Krone'), ('DOP', 'DOP - Dominican Peso'), ('DZD', 'DZD - Algerian Dinar'), ('EEK', 'EEK - Kroon'), ('EGP', 'EGP - Egyptian Pound'), ('ERN', 'ERN - Nakfa'), ('ETB', 'ETB - Ethiopian Birr'), ('EUR', 'EUR - Euro'), ('FJD', 'FJD - Fiji Dollar'), ('FKP', 'FKP - Falkland Islands Pound'), ('GBP', 'GBP - Pound Sterling'), ('GEL', 'GEL - Lari'), ('GHS', 'GHS - Cedi'), ('GIP', 'GIP - Gibraltar Pound'), ('GMD', 'GMD - Dalasi'), ('GNF', 'GNF - Guinea Franc'), ('GTQ', 'GTQ - Quetzal'), ('GYD', 'GYD - Guyana Dollar'), ('HKD', 'HKD - Hong Kong Dollar'), ('HNL', 'HNL - Lempira'), ('HRK', 'HRK - Kuna'), ('HTG', 'HTG - Gourde'), ('HUF', 'HUF - Forint'), ('IDR', 'IDR - Rupiah'), ('ILS', 'ILS - New Israeli Sheqel'), ('INR', 'INR - Indian Rupee'), ('IQD', 'IQD - Iraqi Dinar'), ('IRR', 'IRR - Iranian Rial'), ('ISK', 'ISK - Iceland Krona'), ('JMD', 'JMD - Jamaican Dollar'), ('JOD', 'JOD - Jordanian Dinar'), ('JPY', 'JPY - Yen'), ('KES', 'KES - Kenyan Shilling'), ('KGS', 'KGS - Som'), ('KHR', 'KHR - Riel'), ('KMF', 'KMF - Comoro Franc'), ('KPW', 'KPW - North Korean Won'), ('KRW', 'KRW - Won'), ('KWD', 'KWD - Kuwaiti Dinar'), ('KYD', 'KYD - Cayman Islands Dollar'), ('KZT', 'KZT - Tenge'), ('LAK', 'LAK - Kip'), ('LBP', 'LBP - Lebanese Pound'), ('LKR', 'LKR - Sri Lanka Rupee'), ('LRD', 'LRD - Liberian Dollar'), ('LSL', 'LSL - Loti'), ('LTL', 'LTL - Lithuanian Litas'), ('LVL', 'LVL - Latvian Lats'), ('LYD', 'LYD - Libyan Dinar'), ('MAD', 'MAD - Moroccan Dirham'), ('MDL', 'MDL - Moldovan Leu'), ('MGA', 'MGA - Malagasy Ariary'), ('MKD', 'MKD - Denar'), ('MMK', 'MMK - Kyat'), ('MNT', 'MNT - Tugrik'), ('MOP', 'MOP - Pataca'), ('MRO', 'MRO - Ouguiya'), ('MUR', 'MUR - Mauritius Rupee'), ('MVR', 'MVR - Rufiyaa'), ('MWK', 'MWK - Malawi Kwacha'), ('MXN', 'MXN - Mexican Peso'), ('MXV', 'MXV - Mexican Unidad de Inversion (UDI)'), ('MYR', 'MYR - Malaysian Ringgit'), ('MZN', 'MZN - Metical'), ('NAD', 'NAD - Namibia Dollar'), ('NGN', 'NGN - Naira'), ('NIO', 'NIO - Cordoba Oro'), ('NOK', 'NOK - Norwegian Krone'), ('NPR', 'NPR - Nepalese Rupee'), ('NZD', 'NZD - New Zealand Dollar'), ('OMR', 'OMR - Rial Omani'), ('PAB', 'PAB - Balboa'), ('PEN', 'PEN - Nuevo Sol'), ('PGK', 'PGK - Kina'), ('PHP', 'PHP - Philippine Peso'), ('PKR', 'PKR - Pakistan Rupee'), ('PLN', 'PLN - Zloty'), ('PYG', 'PYG - Guarani'), ('QAR', 'QAR - Qatari Rial'), ('RON', 'RON - Romanian Leu'), ('RSD', 'RSD - Serbian Dinar'), ('RUB', 'RUB - Russian Ruble'), ('RWF', 'RWF - Rwanda Franc'), ('SAR', 'SAR - Saudi Riyal'), ('SBD', 'SBD - Solomon Islands Dollar'), ('SCR', 'SCR - Seychelles Rupee'), ('SDG', 'SDG - Sudanese Pound'), ('SEK', 'SEK - Swedish Krona'), ('SGD', 'SGD - Singapore Dollar'), ('SHP', 'SHP - Saint Helena Pound'), ('SLL', 'SLL - Leone'), ('SOS', 'SOS - Somali Shilling'), ('SSP', 'SSP - South Sudanese Pound'), ('SRD', 'SRD - Surinam Dollar'), ('STD', 'STD - Dobra'), ('SVC', 'SVC - El Salvador Colon'), ('SYP', 'SYP - Syrian Pound'), ('SZL', 'SZL - Lilangeni'), ('THB', 'THB - Baht'), ('TJS', 'TJS - Somoni'), ('TMT', 'TMT - Manat'), ('TND', 'TND - Tunisian Dinar'), ('TOP', 'TOP - Paanga'), ('TRY', 'TRY - Turkish Lira'), ('TTD', 'TTD - Trinidad and Tobago Dollar'), ('TWD', 'TWD - New Taiwan Dollar'), ('TZS', 'TZS - Tanzanian Shilling'), ('UAH', 'UAH - Hryvnia'), ('UGX', 'UGX - Uganda Shilling'), ('USD', 'USD - US Dollar'), ('USN', 'USN - US Dollar (Next day)'), ('USS', 'USS - US Dollar (Same day)'), ('UYI', 'UYI - Uruguay Peso en Unidades Indexadas'), ('UYU', 'UYU - Peso Uruguayo'), ('UZS', 'UZS - Uzbekistan Sum'), ('VEF', 'VEF - Bolivar'), ('VND', 'VND - Dong'), ('VUV', 'VUV - Vatu'), ('WST', 'WST - Tala'), ('XAF', 'XAF - CFA Franc BEAC'), ('XBT', 'XBT - Bitcoin'), ('XCD', 'XCD - East Caribbean Dollar'), ('XDR', 'XDR - International Monetary Fund (IMF) Special Drawing Right (SDR)'), ('XOF', 'XOF - CFA Franc BCEAO'), ('XPF', 'XPF - CFP Franc'), ('YER', 'YER - Yemeni Rial'), ('ZAR', 'ZAR - Rand'), ('ZMK', 'ZMK - Zambian Kwacha'), ('ZWL', 'ZWL - Zimbabwe Dollar')]),
+ preserve_default=True,
+ ),
+ migrations.AlterField(
+ model_name='project',
+ name='status',
+ field=akvo.rsr.fields.ValidXMLCharField(default=b'N', max_length=1, verbose_name='status', db_index=True, choices=[(b'N', b''), (b'H', 'Needs funding'), (b'A', 'Active'), (b'C', 'Complete'), (b'L', 'Cancelled'), (b'R', 'Archived')]),
+ preserve_default=True,
+ ),
+ ]
diff --git a/akvo/rsr/models/project.py b/akvo/rsr/models/project.py
index 178096d996..b9852c035d 100644
--- a/akvo/rsr/models/project.py
+++ b/akvo/rsr/models/project.py
@@ -95,7 +95,7 @@ class Project(TimestampsMixin, models.Model):
)
STATUSES_COLORS = {
- '0': 'grey',
+ '': 'grey',
'1': 'orange',
'2': '#AFF167',
'3': 'grey',
@@ -105,40 +105,44 @@ class Project(TimestampsMixin, models.Model):
}
CODE_TO_STATUS = {
- '0': 'N',
+ '': 'N',
'1': 'H',
'2': 'A',
'3': 'C',
'4': 'C',
'5': 'L',
- '6': 'R'
+ '6': 'C'
}
STATUS_TO_CODE = {
- 'N': '0',
+ 'N': '',
'H': '1',
'A': '2',
'C': '3',
'L': '5',
- 'R': '6'
+ 'R': '3'
}
# Status combinations used in conditionals
EDIT_DISABLED = ['3', '5']
- DONATE_DISABLED = ['0', '3', '4', '5', '6']
- NOT_SUSPENDED = ['1', '2', '3', '4', '5']
+ DONATE_DISABLED = ['', '3', '4', '5', '6']
+ NOT_SUSPENDED = ['', '1', '2', '3', '4', '5']
title = ValidXMLCharField(_(u'project title'), max_length=200, db_index=True, blank=True)
subtitle = ValidXMLCharField(_(u'project subtitle'), max_length=200, blank=True)
- status = ValidXMLCharField(_(u'status'), max_length=1, choices=STATUSES, db_index=True, default=STATUS_NONE)
+ status = ValidXMLCharField(
+ _(u'status'), max_length=1, choices=STATUSES, db_index=True, default=STATUS_NONE
+ )
iati_status = ValidXMLCharField(
- _(u'status'), max_length=1, choices=([('0', '')] + codelist_choices(ACTIVITY_STATUS)),
- db_index=True, default='0',
+ _(u'status'), max_length=1, choices=(codelist_choices(ACTIVITY_STATUS)), db_index=True,
+ blank=True,
help_text=_(u'There are six different project statuses:
'
u'1) Pipeline/identification: the project is being scoped or planned
'
u'2) Implementation: the project is currently being implemented
'
- u'3) Completion: the project is complete or the final disbursement has been made
'
- u'4) Post-completion: the project is complete or the final disbursement has been made, '
+ u'3) Completion: the project is complete or the final disbursement has been '
+ u'made
'
+ u'4) Post-completion: the project is complete or the final disbursement has '
+ u'been made, '
u'but the project remains open pending financial sign off or M&E
'
u'5) Cancelled: the project has been cancelled
'
u'6) Suspended: the project has been temporarily suspended '
diff --git a/akvo/templates/myrsr/project_editor/section_1.html b/akvo/templates/myrsr/project_editor/section_1.html
index 829a2dfcae..acbcdc7971 100644
--- a/akvo/templates/myrsr/project_editor/section_1.html
+++ b/akvo/templates/myrsr/project_editor/section_1.html
@@ -37,7 +37,7 @@