Skip to content

Commit

Permalink
[#659] Merge branch 'develop' into feature/659_comment_datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperBrandt committed Jul 29, 2014
2 parents c3c3b19 + cfe9e17 commit b7aa61e
Show file tree
Hide file tree
Showing 37 changed files with 11,703 additions and 200 deletions.
45 changes: 45 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,51 @@ Read more about [Akvo Products](http://akvo.org/products/).

--------

Akvo RSR ver 2.3.9.2 Yam - Hotfix 2
---

Thursday 24th July 2014, adriancollier

Included Changes
---

### Fixes to Import Scripts

We made some small fixes to the import scripts to ensure that all was working correctly for the IATI XML Import processes.

Github issue [#680](https://github.com/akvo/akvo-rsr/issues/680)


--------

Akvo RSR ver 2.3.9.1 Yam - Hotfix
---

Tuesday 8th Juyl 2014, adriancollier

Included Changes
---

### Akvo Pages Keyword Maps

With the implementation of keywords in [#620](https://github.com/akvo/akvo-rsr/issues/620) we noticed that the headline map on Akvo Pages was not updated to display the points for these keyword projects. This has been fixed so it matches the projects being displayed.

Github issue [#671](https://github.com/akvo/akvo-rsr/issues/671)

### Akvo Pages Drop-down Filtering

The drop-down filters for Akvo Pages were not being correctly populated with the keyword content. After trying some things, it appeared that this area of code needs some further investigation to ensure it runs smoothly. In the meantime, we have removed the custom filtering so now all drop-downs contain all possibilities. We AIM to resolve this as soon as possible.

Github issue [#673](https://github.com/akvo/akvo-rsr/issues/673)

### Keyword API Management

We implemented some changes in the API import processes to manage kaywords but it should only be possible to add keywords using the API, existing keywords on projects should not be removed.

Github issue [#670](https://github.com/akvo/akvo-rsr/issues/670)

--------

Akvo RSR ver 2.3.9 Yam
---

Expand Down
2 changes: 1 addition & 1 deletion akvo/api/resources/partnership.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from akvo.api.authentication import ConditionalApiKeyAuthentication
from akvo.api.fields import ConditionalFullToOneField

from akvo.rsr.iati_code_lists import IATI_LIST_ORGANISATION_TYPE
from akvo.rsr.iati.iati_code_lists import IATI_LIST_ORGANISATION_TYPE
from akvo.rsr.models import Organisation, Partnership, InternalOrganisationID

from .resources import ConditionalFullResource
Expand Down
38 changes: 29 additions & 9 deletions akvo/api/resources/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,11 @@ def obj_update(self, bundle, skip_errors=False, **kwargs):
Goal.objects.filter(project=bundle.obj).delete()
BudgetItem.objects.filter(project=bundle.obj).delete()
ProjectLocation.objects.filter(location_target=bundle.obj).delete()
# Since all locations for the project are deleted we need to make sure Project.primary_location is set to None
bundle.obj.primary_location = None
bundle.obj.save()
Partnership.objects.filter(project=bundle.obj).delete()
Benchmark.objects.filter(project=bundle.obj).delete()
Keyword.objects.filter(project=bundle.obj).delete()
bundle.obj.categories.clear()

self.authorized_update_detail(self.get_object_list(bundle.request), bundle)
Expand Down Expand Up @@ -182,16 +184,32 @@ def alter_deserialized_detail_data(self, request, data):
partnership[FIELD_LONG_NAME] = partnership[FIELD_LONG_NAME][:75]
return data

def hydrate_date_complete(self, bundle):
date_complete = bundle.data.get('date_complete')
if date_complete and date_complete[-1] == 'Z':
bundle.data['date_complete'] = date_complete[:-1]
def hydrate_date_end_actual(self, bundle):
date_end_actual = bundle.data.get('date_end_actual')
if date_end_actual and date_end_actual[-1] == 'Z':
bundle.data['date_end_actual'] = date_end_actual[:-1]
return bundle

def hydrate_date_request_posted(self, bundle):
date_request_posted = bundle.data.get('date_request_posted')
if date_request_posted and date_request_posted[-1] == 'Z':
bundle.data['date_request_posted'] = date_request_posted[:-1]
def hydrate_date_start_actual(self, bundle):
date_start_actual = bundle.data.get('date_start_actual')
if date_start_actual and date_start_actual[-1] == 'Z':
bundle.data['date_start_actual'] = date_start_actual[:-1]
return bundle

def hydrate_date_end_planned(self, bundle):
date_end_planned = bundle.data.get('date_end_planned')
if date_end_planned and date_end_planned[-1] == 'Z':
bundle.data['date_end_planned'] = date_end_planned[:-1]
if date_end_planned:
bundle.data['date_complete'] = bundle.data.pop('date_end_planned')
return bundle

def hydrate_date_start_planned(self, bundle):
date_start_planned = bundle.data.get('date_start_planned')
if date_start_planned and date_start_planned[-1] == 'Z':
bundle.data['date_start_planned'] = date_start_planned[:-1]
if date_start_planned:
bundle.data['date_request_posted'] = bundle.data.pop('date_start_planned')
return bundle

# def hydrate_categories(self, bundle):
Expand Down Expand Up @@ -313,4 +331,6 @@ def dehydrate(self, bundle):
'original': bundle.data['current_image'],
'thumbnails': get_extra_thumbnails(bundle.obj.current_image),
}
bundle.data['date_request_posted'] = bundle.data.pop('date_start_planned')
bundle.data['date_complete'] = bundle.data.pop('date_end_planned')
return bundle
50 changes: 40 additions & 10 deletions akvo/api/xml/iati-xslt.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -183,33 +183,63 @@
</currency>
</xsl:template>

<!-- date_request_posted -->
<!-- date_start_actual -->
<xsl:template match="activity-date[@type='start-actual']">
<!-- two ways of expressing the date, either as data in the node or as the iso-date attribute -->
<xsl:if test="not(.='')">
<date_request_posted>
<date_start_actual>
<xsl:value-of select="normalize-space(.)" />
</date_request_posted>
</date_start_actual>
</xsl:if>
<xsl:if test=".=''">
<date_request_posted>
<date_start_actual>
<xsl:value-of select="normalize-space(@iso-date)"/>
</date_request_posted>
</date_start_actual>
</xsl:if>
</xsl:template>

<!-- date_complete -->
<!-- date_end_actual -->
<xsl:template match="activity-date[@type='end-actual']">
<!-- two ways of expressing the date, either as data in the node or as the iso-date attribute -->
<xsl:if test="not(.='')">
<date_complete>
<date_end_actual>
<xsl:value-of select="normalize-space(.)" />
</date_complete>
</date_end_actual>
</xsl:if>
<xsl:if test=".=''">
<date_complete>
<date_end_actual>
<xsl:value-of select="normalize-space(@iso-date)"/>
</date_complete>
</date_end_actual>
</xsl:if>
</xsl:template>

<!-- date_start_planned -->
<xsl:template match="activity-date[@type='start-planned']">
<!-- two ways of expressing the date, either as data in the node or as the iso-date attribute -->
<xsl:if test="not(.='')">
<date_start_planned>
<xsl:value-of select="normalize-space(.)" />
</date_start_planned>
</xsl:if>
<xsl:if test=".=''">
<date_start_planned>
<xsl:value-of select="normalize-space(@iso-date)"/>
</date_start_planned>
</xsl:if>
</xsl:template>

<!-- date_end_planned -->
<xsl:template match="activity-date[@type='end-planned']">
<!-- two ways of expressing the date, either as data in the node or as the iso-date attribute -->
<xsl:if test="not(.='')">
<date_end_planned>
<xsl:value-of select="normalize-space(.)" />
</date_end_planned>
</xsl:if>
<xsl:if test=".=''">
<date_end_planned>
<xsl:value-of select="normalize-space(@iso-date)"/>
</date_end_planned>
</xsl:if>
</xsl:template>

Expand Down
2 changes: 1 addition & 1 deletion akvo/cordaid_org_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from django.core.files import File
from django.core.files.temp import NamedTemporaryFile

from akvo.rsr.iati_code_lists import IATI_LIST_ORGANISATION_TYPE
from akvo.rsr.iati.iati_code_lists import IATI_LIST_ORGANISATION_TYPE
from akvo.rsr.models import InternalOrganisationID, Organisation, PartnerType
from akvo.utils import model_and_instance_based_filename

Expand Down
Loading

0 comments on commit b7aa61e

Please sign in to comment.