Skip to content

Commit

Permalink
Merge pull request #2063 from akvo/#1920-iati-202-feedback
Browse files Browse the repository at this point in the history
[#1920] IATI v2.02 feedback
  • Loading branch information
KasperBrandt committed Mar 17, 2016
2 parents c08eb8e + 0cfc299 commit 36edbac
Show file tree
Hide file tree
Showing 10 changed files with 322 additions and 83 deletions.
172 changes: 172 additions & 0 deletions akvo/rsr/migrations/0064_auto_20160317_1238.py

Large diffs are not rendered by default.

73 changes: 55 additions & 18 deletions akvo/rsr/models/crs_add.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,47 +26,79 @@ class CrsAdd(models.Model):
project = models.OneToOneField('Project', primary_key=True)
loan_terms_rate1 = models.DecimalField(
_(u'loan terms rate 1'), blank=True, null=True, max_digits=5, decimal_places=2,
validators=[MaxValueValidator(100), MinValueValidator(0)]
validators=[MaxValueValidator(100), MinValueValidator(0)],
help_text=_(u'Interest Rate. If an ODA loan with variable interest rate, report the '
u'variable rate here and the reference fixed rate as rate 2.')
)
loan_terms_rate2 = models.DecimalField(
_(u'loan terms rate 2'), blank=True, null=True, max_digits=5, decimal_places=2,
validators=[MaxValueValidator(100), MinValueValidator(0)]
validators=[MaxValueValidator(100), MinValueValidator(0)],
help_text=_(u'Second Interest Rate. If an ODA loan with variable interest rate, report the '
u'variable rate as rate 1 and the reference fixed rate here.')
)
repayment_type = ValidXMLCharField(
_(u'loan terms repayment type'), max_length=1,
choices=codelist_choices(LOAN_REPAYMENT_TYPE), blank=True
choices=codelist_choices(LOAN_REPAYMENT_TYPE), blank=True,
help_text=_(u'An IATI codelist tabulating CRS-specified values for the type of Repayment. '
u'See the <a href="http://iatistandard.org/202/codelists/LoanRepaymentType/" '
u'target="_blank">IATI codelist</a>.')
)
repayment_plan = ValidXMLCharField(
_(u'loan terms repayment plan'), max_length=2,
choices=codelist_choices(LOAN_REPAYMENT_PERIOD), blank=True
choices=codelist_choices(LOAN_REPAYMENT_PERIOD), blank=True,
help_text=_(u'An IATI codelist tabulating CRS-specified values for the number of '
u'repayments per annum. See the <a href="http://iatistandard.org/202/codelists/'
u'LoanRepaymentPeriod/" target="_blank">IATI codelist</a>.')
)
commitment_date = models.DateField(
_(u'loan terms commitment date'), null=True, blank=True,
help_text=_(u'The CRS++ reported commitment date.')
)
repayment_first_date = models.DateField(
_(u'loan terms first repayment date'), null=True, blank=True,
help_text=_(u'The CRS++ reported first repayment date.')
)
repayment_final_date = models.DateField(
_(u'loan terms final repayment date'), null=True, blank=True,
help_text=_(u'The CRS++ reported final repayment date.')
)
commitment_date = models.DateField(_(u'loan terms commitment date'), null=True, blank=True)
repayment_first_date = models.DateField(_(u'loan terms first repayment date'), null=True,
blank=True)
repayment_final_date = models.DateField(_(u'loan terms final repayment date'), null=True,
blank=True)
loan_status_year = models.PositiveIntegerField(
_(u'loan status year'), blank=True, null=True, max_length=4
_(u'loan status year'), blank=True, null=True, max_length=4,
help_text=_(u'CRS reporting year (CRS++ Column 1).')
)
loan_status_currency = ValidXMLCharField(
_(u'loan status currency'), blank=True, max_length=3, choices=codelist_choices(CURRENCY)
)
loan_status_value_date = models.DateField(_(u'loan status value date'), blank=True, null=True)
loan_status_value_date = models.DateField(
_(u'loan status value date'), blank=True, null=True,
help_text=_(u'Enter the specific date (DD/MM/YYYY) for the loan status values.')
)
interest_received = models.DecimalField(
_(u'loan status interest received'), max_digits=10, decimal_places=2, blank=True, null=True
_(u'loan status interest received'), max_digits=10, decimal_places=2, blank=True, null=True,
help_text=_(u'Interest received during the reporting year.')
)
principal_outstanding = models.DecimalField(
_(u'loan status principal outstanding'), max_digits=10, decimal_places=2, blank=True,
null=True
null=True, help_text=_(u'The amount of principal owed on the loan at the end of the '
u'reporting year.')
)
principal_arrears = models.DecimalField(
_(u'loan status principal arrears'), max_digits=10, decimal_places=2, blank=True, null=True
_(u'loan status principal arrears'), max_digits=10, decimal_places=2, blank=True, null=True,
help_text=_(u'Arrears of principal at the end of the year. Included in principal '
u'outstanding.')
)
interest_arrears = models.DecimalField(
_(u'loan status interest arrears'), max_digits=10, decimal_places=2, blank=True, null=True
_(u'loan status interest arrears'), max_digits=10, decimal_places=2, blank=True, null=True,
help_text=_(u'Arrears of interest at the end of the year.')
)
channel_code = ValidXMLCharField(
_(u'channel code'), blank=True, max_length=5, choices=codelist_choices(C_R_S_CHANNEL_CODE))
_(u'channel code'), blank=True, max_length=5, choices=codelist_choices(C_R_S_CHANNEL_CODE),
help_text=_(u'The CRS channel code for this activity. The codelist contains both '
u'organisation types and names of organisations. For non-CRS purposes these '
u'should be reported using participating organisations. See the <a '
u'href="http://iatistandard.org/202/codelists/CRSChannelCode/" '
u'target="_blank">IATI codelist</a>.')
)

def __unicode__(self):
return u'CRS++'
Expand Down Expand Up @@ -95,9 +127,14 @@ class CrsAddOtherFlag(models.Model):
"""
crs = models.ForeignKey('CrsAdd', verbose_name=u'crs', related_name='other_flags')
code = ValidXMLCharField(
_(u'code'), max_length=1, choices=codelist_choices(C_R_S_ADD_OTHER_FLAGS)
_(u'code'), max_length=1, choices=codelist_choices(C_R_S_ADD_OTHER_FLAGS),
help_text=_(u'An IATI code describing the equivalent CRS++ columns. See the <a '
u'href="http://iatistandard.org/202/codelists/CRSAddOtherFlags/" '
u'target="_blank">IATI codelist</a>.')
)
significance = models.NullBooleanField(
_(u'significance'), blank=True, help_text=_(u'Indicate whether the flag applies or not.')
)
significance = models.NullBooleanField(_(u'significance'), blank=True)

def __unicode__(self):
if self.code:
Expand Down
39 changes: 29 additions & 10 deletions akvo/rsr/models/fss.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ class Fss(models.Model):
Items specific to OECD DAC Forward Spending Survey. Can only occur once per project.
"""
project = models.OneToOneField('Project', primary_key=True)
extraction_date = models.DateField(_(u'extraction date'), null=True, blank=True)
priority = models.NullBooleanField(_(u'priority'), blank=True)
phaseout_year = models.PositiveIntegerField(_(u'phaseout year'), blank=True, null=True,
max_length=4)
extraction_date = models.DateField(
_(u'extraction date'), null=True, blank=True,
help_text=_(u'The exact date when the information was collected or extracted from donors\' '
u'aid management systems.')
)
priority = models.NullBooleanField(
_(u'priority'), blank=True,
help_text=_(u'True if the partner country is a priority partner country.')
)
phaseout_year = models.PositiveIntegerField(
_(u'phaseout year'), blank=True, null=True, max_length=4,
help_text=_(u'If there are plans to phase out operations from the partner country, this '
u'shows the projected year of last disbursements.')
)

def __unicode__(self):
return u'%s' % _(u'Forward Spending Survey')
Expand All @@ -39,12 +49,21 @@ class FssForecast(models.Model):
Forecast items for an OECD DAC Forward Spending Survey item.
"""
fss = models.ForeignKey('Fss', verbose_name=_(u'fss'), related_name='forecasts')
year = models.PositiveIntegerField(_(u'year'), blank=True, null=True, max_length=4)
value_date = models.DateField(_(u'value date'), blank=True, null=True)
currency = ValidXMLCharField(_(u'currency'), blank=True, max_length=3,
choices=codelist_choices(CURRENCY))
value = models.DecimalField(_(u'interest received'), max_digits=10, decimal_places=2,
blank=True, null=True)
year = models.PositiveIntegerField(
_(u'year'), blank=True, null=True, max_length=4,
help_text=_(u'The calendar year that the forward spend covers.')
)
value_date = models.DateField(
_(u'value date'), blank=True, null=True,
help_text=_(u'Enter the specific date (DD/MM/YYYY) for the forecast value.')
)
currency = ValidXMLCharField(
_(u'currency'), blank=True, max_length=3, choices=codelist_choices(CURRENCY)
)
value = models.DecimalField(
_(u'forecast value'), max_digits=10, decimal_places=2, blank=True, null=True,
help_text=_(u'The forecast value for each year.')
)

def __unicode__(self):
if self.value and self.currency:
Expand Down
5 changes: 3 additions & 2 deletions akvo/rsr/models/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ class IndicatorReference(models.Model):
_(u'reference code'), blank=True, max_length=25,
help_text=_(u'A code for an indicator defined in the specified vocabulary specified. '
u'For more information on the indicator reference, see the '
u'<a href="http://iatistandard.org/202/codelists/IndicatorVocabulary/" '
u'target="_blank">IATI codelist</a>.'))
u'<a href="http://iatistandard.org/202/activity-standard/iati-activities/'
u'iati-activity/result/indicator/reference/" target="_blank">IATI '
u'codelist</a>.'))
vocabulary = ValidXMLCharField(
_(u'reference vocabulary'), blank=True, max_length=2,
choices=codelist_choices(INDICATOR_VOCABULARY),
Expand Down
15 changes: 12 additions & 3 deletions akvo/rsr/models/legacy_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,18 @@

class LegacyData(models.Model):
project = models.ForeignKey('Project', verbose_name=_(u'project'), related_name='legacy_data')
name = ValidXMLCharField(_(u'name'), blank=True, max_length=1000)
value = ValidXMLCharField(_(u'value'), blank=True, max_length=1000)
iati_equivalent = ValidXMLCharField(_(u'iati equivalent'), blank=True, max_length=1000)
name = ValidXMLCharField(
_(u'name'), blank=True, max_length=1000,
help_text=_(u'The original field name in the reporting organisation\'s system.')
)
value = ValidXMLCharField(
_(u'value'), blank=True, max_length=1000,
help_text=_(u'The original field value in the reporting organisation\'s system.')
)
iati_equivalent = ValidXMLCharField(
_(u'iati equivalent'), blank=True, max_length=1000,
help_text=_(u'The name of the equivalent IATI element.')
)

def __unicode__(self):
if self.name and self.value:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
<div class="crs-add-item parent" id="crs_add.{{ crs|obj_id }}">
{% include "myrsr/project_editor/partials/related_object_header.html" with rel_obj=crs %}
<div class="hide-partial {% if crs.pk %}hidden{% endif %}">
<div class="row">
<div class="col-md-6">
{% include percentage_input with obj=crs field='loan_terms_rate1' %}
</div>
<div class="col-md-6">
{% include percentage_input with obj=crs field='loan_terms_rate2' %}
</div>
</div>
<div class="row">
<div class="col-md-6">
{% include choice_input with obj=crs field='repayment_type' %}
Expand All @@ -30,6 +22,14 @@
{% include date_input with obj=crs field='repayment_final_date' %}
</div>
</div>
<div class="row">
<div class="col-md-6">
{% include percentage_input with obj=crs field='loan_terms_rate1' %}
</div>
<div class="col-md-6">
{% include percentage_input with obj=crs field='loan_terms_rate2' %}
</div>
</div>
<div class="row">
<div class="col-md-4">
{% include text_input with obj=crs field='loan_status_year' number=True %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ <h5>{% trans 'Indicator references' %}</h5>
<div class="indicator-reference-container" id="indicator-reference-container">
{% for reference in indicator.references.all %}
{% include "myrsr/project_editor/related_objects/indicator_reference_input.html" %}
{% empty %}
{% with indicator_id_string=indicator.pk|default:"new-0"|stringformat:"s" %}
{% include "myrsr/project_editor/related_objects/indicator_reference_input.html" with reference='IndicatorReference.'|add:project_id_string|add:'_'|add:result_id_string|add:'_'|add:indicator_id_string %}
{% endwith %}
{# {% empty %}#}
{# {% with indicator_id_string=indicator.pk|default:"new-0"|stringformat:"s" %}#}
{# {% include "myrsr/project_editor/related_objects/indicator_reference_input.html" with reference='IndicatorReference.'|add:project_id_string|add:'_'|add:result_id_string|add:'_'|add:indicator_id_string %}#}
{# {% endwith %}#}
{% endfor %}
<div class="row form-group">
<div class="col-md-12 text-center add-object-link">
<a href="#" class="add-indicator-reference"><span class="glyphicon glyphicon-plus"></span> {% trans 'Add another indicator reference' %}</a>
<a href="#" class="add-indicator-reference"><span class="glyphicon glyphicon-plus"></span> {% trans 'Add indicator reference' %}</a>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 36edbac

Please sign in to comment.