Skip to content

Commit c4f3b08

Browse files
committed
RSR v2.3.9.1 Yam Hotfix - Merge branch 'release/candidate' of github.com:akvo/akvo-rsr
2 parents eefb324 + 7c182eb commit c4f3b08

File tree

7 files changed

+74
-29
lines changed

7 files changed

+74
-29
lines changed

RELEASE_NOTES.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,33 @@ Read more about [Akvo Products](http://akvo.org/products/).
77

88
--------
99

10+
Akvo RSR ver 2.3.9.1 Yam - Hotfix
11+
12+
Tuesday 8th Juyl 2014, adriancollier
13+
14+
Included Changes
15+
---
16+
17+
### Akvo Pages Keyword Maps
18+
19+
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.
20+
21+
Github issue [#671](https://github.com/akvo/akvo-rsr/issues/671)
22+
23+
### Akvo Pages Drop-down Filtering
24+
25+
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.
26+
27+
Github issue [#673](https://github.com/akvo/akvo-rsr/issues/673)
28+
29+
### Keyword API Management
30+
31+
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.
32+
33+
Github issue [#670](https://github.com/akvo/akvo-rsr/issues/670)
34+
35+
--------
36+
1037
Akvo RSR ver 2.3.9 Yam
1138
---
1239

akvo/api/resources/project.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def obj_update(self, bundle, skip_errors=False, **kwargs):
105105
ProjectLocation.objects.filter(location_target=bundle.obj).delete()
106106
Partnership.objects.filter(project=bundle.obj).delete()
107107
Benchmark.objects.filter(project=bundle.obj).delete()
108-
Keyword.objects.filter(project=bundle.obj).delete()
109108
bundle.obj.categories.clear()
110109

111110
self.authorized_update_detail(self.get_object_list(bundle.request), bundle)

akvo/rsr/filters.py

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,9 @@ def filter_by_budget_range(qs, what):
7373
currency = django_filters.ChoiceFilter()
7474

7575
def __init__(self, *args, **kwargs):
76-
organisation_id = kwargs.pop('organisation_id', None)
76+
request = kwargs.pop('request', None)
7777
super(ProjectFilterSet, self).__init__(*args, **kwargs)
78+
projects = kwargs.pop('queryset', None)
7879

7980
self.filters['title'].field.widget.input_type = 'search'
8081
self.filters['title'].field.widget.attrs = {'results': '5', 'autosave': 'project_search', 'placeholder': _(u'Project title or subtitle')}
@@ -83,29 +84,37 @@ def __init__(self, *args, **kwargs):
8384
choices.extend(list(CONTINENTS))
8485
self.filters['continent'].extra.update({'choices': choices})
8586

86-
self.filters['locations__country'].extra.update({'empty_label': _(u'All countries')})
8787

88-
if organisation_id:
89-
org = Organisation.objects.get(pk=organisation_id)
90-
91-
countries = org.countries_where_active()
92-
93-
continents = [('', _(u'All continents'))]
94-
choices = []
95-
for country in countries:
96-
if not country.continent_code in [code[0] for code in choices]:
97-
choices.append((country.continent_code, _(country.continent)))
98-
continents.extend(sorted(choices))
99-
100-
self.filters['continent'].extra.update({'choices': continents})
101-
self.filters['locations__country'].extra.update({'queryset': countries})
102-
103-
qs = org.partners()
88+
# The request is sent when the call is made from a partner site view
89+
if request:
90+
partner_site = request.partner_site
91+
organisation = partner_site.organisation
92+
# If the partner site is "normal"
93+
if partner_site.partner_projects:
94+
countries = organisation.countries_where_active()
95+
96+
continents = [('', _(u'Active continents'))]
97+
choices = []
98+
for country in countries:
99+
if not country.continent_code in [code[0] for code in choices]:
100+
choices.append((country.continent_code, _(country.continent)))
101+
continents.extend(sorted(choices))
102+
103+
self.filters['continent'].extra.update({'choices': continents})
104+
self.filters['locations__country'].extra.update({'queryset': countries})
105+
self.filters['locations__country'].extra.update({'empty_label': _(u'Active countries')})
106+
107+
organisations = organisation.partners()
108+
# Keyword driven partner site.
109+
# Performance issues preclude filtering of filter drop-downs right now
110+
else:
111+
organisations = Organisation.objects.all()
112+
self.filters['locations__country'].extra.update({'empty_label': _(u'All countries')})
104113
self.filters['organisation'].extra.update({'empty_label': _(u'All partners')})
105114
else:
106-
qs = Organisation.objects.all()
115+
organisations = Organisation.objects.all()
107116
self.filters['organisation'].extra.update({'empty_label': _(u'All organisations')})
108-
self.filters['organisation'].extra.update({'queryset': qs})
117+
self.filters['organisation'].extra.update({'queryset': organisations})
109118

110119
self.filters['andor'].field_class = BooleanField
111120
self.filters['status'].field_class = CheckboxMultipleChoiceField

akvo/rsr/middleware.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ def process_request(self, request, cname_domain=False, partner_site=None):
161161
)
162162
request.akvoapp_root_url = "http://%s" % request.app_domain
163163
request.organisation_id = partner_site.organisation.id
164+
request.partner_site = partner_site
164165
request.default_language = partner_site.default_language
165166

166167
request.domain_url = "http://%s" % settings.RSR_DOMAIN

akvo/rsr/templatetags/maps.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def global_organisation_map(width, height, dynamic='dynamic'):
171171

172172

173173
@register.inclusion_tag('inclusion_tags/maps.html')
174-
def organisation_projects_map(organisation_id, width, height, dynamic='dynamic'):
174+
def organisation_projects_map(projects, width, height, dynamic='dynamic'):
175175
"""
176176
params:
177177
organisation_id: id of organisation.
@@ -187,18 +187,27 @@ def organisation_projects_map(organisation_id, width, height, dynamic='dynamic')
187187

188188
locations = []
189189

190-
projects = Project.objects.filter(partnerships__organisation=organisation_id).active()
190+
# projects = Project.objects.filter(partnerships__organisation=organisation_id).active()
191191

192192
for project in projects:
193193
proj_locations = ProjectLocation.objects.filter(location_target=project)
194194
for location in proj_locations:
195195
try:
196196
thumbnail = project.current_image.extra_thumbnails['map_thumb'].absolute_url
197-
locations.append([location.latitude,
198-
location.longitude,
199-
[str(project.pk),project.title.encode('utf8'), thumbnail, 'project']])
200197
except:
201-
pass
198+
thumbnail = ""
199+
locations.append(
200+
[
201+
location.latitude,
202+
location.longitude,
203+
[
204+
str(project.pk),
205+
project.title.encode('utf8'),
206+
thumbnail,
207+
'project'
208+
]
209+
]
210+
)
202211

203212
template_context = {
204213
'map_id': map_id,

akvo/rsr/views_partner_sites/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,5 @@ def get_queryset(self):
170170
return ProjectFilterSet(
171171
self.request.GET.copy() or None,
172172
queryset=projects,
173-
organisation_id=self.request.organisation_id
173+
request=self.request
174174
)

akvo/templates/partner_sites/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</div>
3232
</div>
3333
<div class="two_col_right whitebox">
34-
{% organisation_projects_map request.organisation_id 470 250 'dynamic' %}
34+
{% organisation_projects_map sorted_projects 470 250 'dynamic' %}
3535
</div>
3636
<div class="clear"></div>
3737
<h1 class="marg_top20">{% trans "Find projects" %}</h1>

0 commit comments

Comments
 (0)