Skip to content

Commit

Permalink
Merge pull request #224 from willemarcel/add-aoi-param-to-atom-link
Browse files Browse the repository at this point in the history
Add aoi param to items link on RSS feed
  • Loading branch information
willemarcel committed Oct 2, 2019
2 parents 669594a + c3d86d8 commit f5db7d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions osmchadjango/supervise/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,11 @@ def test_aoi_changesets_feed_view(self):
rss_data = ET.fromstring(response.content).getchildren()[0].getchildren()
title = [i for i in rss_data if i.tag == 'title'][0]
items = [i for i in rss_data if i.tag == 'item']
link = [i for i in items[0].getchildren() if i.tag == 'link'][0]
self.assertIn(
"?aoi=",
link.text
)
self.assertEqual(
title.text,
'Changesets of Area of Interest {} by {}'.format(
Expand Down
6 changes: 5 additions & 1 deletion osmchadjango/supervise/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class AOIListChangesetsFeedView(Feed):
"""

def get_object(self, request, pk):
self.feed_id = pk
return AreaOfInterest.objects.get(pk=pk)

def title(self, obj):
Expand All @@ -138,7 +139,10 @@ def item_geometry(self, item):
return item.bbox

def item_link(self, item):
return reverse('frontend:changeset-detail', args=[item.id])
return '{}{}'.format(reverse(
'frontend:changeset-detail',
args=[item.id]
), '?aoi={}'.format(self.feed_id))

def item_pubdate(self, item):
return item.date
Expand Down

0 comments on commit f5db7d4

Please sign in to comment.