Skip to content

Commit

Permalink
Fix /uprn lookup broken by previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
davea committed Apr 16, 2024
1 parent cf62a83 commit 8774d9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions mapit_labour/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@


class LoginRequiredTestCase(LoadTestData, TestCase):
fixtures = ["uk", "test_areas"]

def test_redirect_to_login(self):
self.client.logout()

Expand Down
7 changes: 2 additions & 5 deletions mapit_labour/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,8 @@
def uprn(request, uprn, format="json"):
uprn = get_object_or_404(UPRN, format=format, uprn=uprn)

try:
generation = int(request.GET["generation"])
except:
generation = Generation.objects.current()
areas = list(add_codes(Area.objects.by_location(uprn.location, generation)))
query = Generation.objects.query_args(request, format)
areas = list(add_codes(Area.objects.by_location(uprn.location, query)))

shortcuts = {}
for area in areas:
Expand Down

0 comments on commit 8774d9e

Please sign in to comment.