From 977bf6891a9b117572d9559bf64c808153f32b83 Mon Sep 17 00:00:00 2001 From: Garrett Date: Sat, 7 Jan 2017 15:10:33 -0600 Subject: [PATCH] fix #68 --- .../templates/locations/location_detail.html | 82 +++++++++---------- locations/views.py | 12 +-- 2 files changed, 47 insertions(+), 47 deletions(-) diff --git a/locations/templates/locations/location_detail.html b/locations/templates/locations/location_detail.html index d8b6904..1cd7971 100644 --- a/locations/templates/locations/location_detail.html +++ b/locations/templates/locations/location_detail.html @@ -72,48 +72,46 @@

Locations

{% if this_world %} - {% if not this_location %} -
- -

{{ this_world.name }}

-
- - - -
-
-

{{ this_world.content|safe }}

-
- {% elif this_location %} -
- -

{{ this_location.name }}

-
- - - -
-
-

{{ this_location.content|safe }}

-
- {% endif %} +
+ +

{{ this_world.name }}

+
+ + + +
+
+

{{ this_world.content|safe }}

+
+ {% elif this_location %} +
+ +

{{ this_location.name }}

+
+ + + +
+
+

{{ this_location.content|safe }}

+
{% else %}
diff --git a/locations/views.py b/locations/views.py index 2aab331..2f7f04b 100644 --- a/locations/views.py +++ b/locations/views.py @@ -27,11 +27,13 @@ def location_detail(request, world_pk=None, location_pk=None): if world_pk: this_world = get_object_or_404(models.World, pk=world_pk) if this_world.user == request.user: - if location_pk: - this_location = get_object_or_404(models.Location, pk=location_pk) - return render(request, 'locations/location_detail.html', {'this_world': this_world, 'this_location': this_location, 'worlds': worlds, 'locations': locations}) - else: - return render(request, 'locations/location_detail.html', {'this_world': this_world, 'worlds': worlds, 'locations': locations}) + return render(request, 'locations/location_detail.html', {'this_world': this_world, 'worlds': worlds, 'locations': locations}) + else: + raise Http404 + elif location_pk: + this_location = get_object_or_404(models.Location, pk=location_pk) + if this_location.user == request.user: + return render(request, 'locations/location_detail.html', {'this_world': this_world, 'this_location': this_location, 'worlds': worlds, 'locations': locations}) else: raise Http404 else: