Merge branch 'feature-newstyles' into develop
[snf-cloudcms] / cloudcmsfaq / views.py
index 9c75140..4bf7317 100644 (file)
@@ -35,8 +35,9 @@
 from django.conf import settings
 from django.views.generic.simple import direct_to_template
 from django.http import HttpResponseRedirect, Http404
+from django.shortcuts import get_object_or_404
 
-from cloudcms.models import Application
+from cloudcms.models import Application, Service
 from cloudcmsfaq.models import Question, Category, CategoryTranslation
 
 def index(request):
@@ -47,17 +48,19 @@ def archive(request):
     Display entries list
     """
     app = Application.current()
-    categories = Category.objects.all()
+    services = Service.objects.all()
+
     return direct_to_template(request,
-            "cloudcmsfaq/archive.html", {'categories': categories})
+            "cloudcmsfaq/archive.html", {'services': services})
 
-def detail(request, category, slug):
+def detail(request, service, slug):
     """
     Display detailed question.
     """
-    entry = Question.objects.get(slug=slug)
-    categories = Category.objects.filter(pk=entry.category.pk)
+    entry = get_object_or_404(Question, slug=slug)
+    services = Service.objects.all()
+
     return direct_to_template(request,
-            "cloudcmsfaq/detail.html", {'question': entry, 
-                                        'categories': categories})
+            "cloudcmsfaq/detail.html", {'question': entry,
+                                        'services': services })