Skip to content

Commit

Permalink
Fix for #248
Browse files Browse the repository at this point in the history
  • Loading branch information
Elijahwalkerwest committed Mar 30, 2018
1 parent 0179d1c commit 41fcf6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sensordatainterface/views/detail_views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from sensordatainterface.base_views import *
from django.views.generic import DetailView
from sensordatainterface.forms import *
from django.http import *


# Detail View Generic.
class GenericDetailView(DetailView):
@method_decorator(login_required(login_url=LOGIN_URL))
def dispatch(self, *args, **kwargs):
try:
action_type = self.context_object_name.lower()
action = Action.objects.get(pk=self.kwargs['slug'], actiontypecv__name__icontains=action_type)
except:
raise Http404()
return super(GenericDetailView, self).dispatch(*args, **kwargs)


Expand All @@ -17,6 +23,10 @@ class SiteVisitDetailView(DetailView):
template_name = 'site-visits/details.html'

def get_context_data(self, **kwargs):
try:
site_visit = Action.objects.get(pk=self.kwargs['slug'], actiontypecv_id='Site visit')
except:
raise Http404()
context = super(SiteVisitDetailView, self).get_context_data(**kwargs)
site_visits = Action.objects.filter(actiontypecv='Site Visit', featureaction__isnull=False)

Expand Down

0 comments on commit 41fcf6f

Please sign in to comment.