Revision bd9ce789

b/cloudcmsblog/views.py
35 35
from django.conf import settings
36 36
from django.views.generic.simple import direct_to_template
37 37
from django.http import HttpResponseRedirect, Http404
38
from django.shortcuts import get_object_or_404
38 39

  
39 40
from cloudcms.models import Application
40 41
from cloudcmsblog.models import Entry, Category, CategoryTranslation
......
49 50

  
50 51
    return HttpResponseRedirect(categories[0].get_absolute_url())
51 52

  
53

  
52 54
def archive(request, category):
53 55
    """
54 56
    Display entries list
55 57
    """
56 58
    app = Application.current()
57
    category = CategoryTranslation.objects.get(slug=category).parent
59
    category = get_object_or_404(Category, translations__slug=category)
58 60
    entries = category.blogentries.all()
59 61
    return direct_to_template(request,
60 62
            "cloudcmsblog/archive.html", {'entries': entries,
61 63
                'ENTRIES_PER_PAGE': getattr(settings,
62 64
                    'CLOUDCMSBLOG_ENTRIES_PER_PAGE', 2)})
63 65

  
66

  
64 67
def detail(request, year, month, day, slug):
65 68
    """
66 69
    Display detailed blog entry.
67 70
    """
68
    entry = Entry.objects.get(published_on__year=year,
71
    entry = get_object_or_404(Entry, published_on__year=year,
69 72
            published_on__month=month, published_on__day=day,
70 73
            slug=slug, is_active=True)
71 74
    return direct_to_template(request,
b/cloudcmsfaq/views.py
35 35
from django.conf import settings
36 36
from django.views.generic.simple import direct_to_template
37 37
from django.http import HttpResponseRedirect, Http404
38
from django.shortcuts import get_object_or_404
38 39

  
39 40
from cloudcms.models import Application, Service
40 41
from cloudcmsfaq.models import Question, Category, CategoryTranslation
......
56 57
    """
57 58
    Display detailed question.
58 59
    """
59
    entry = Question.objects.get(slug=slug)
60
    entry = get_object_or_404(Question, slug=slug)
60 61
    services = Service.objects.all()
61
    
62

  
62 63
    return direct_to_template(request,
63 64
            "cloudcmsfaq/detail.html", {'question': entry,
64 65
                                        'services': services })
b/cloudcmsguide/views.py
55 55
    """
56 56
    Display detailed entry.
57 57
    """
58
    entry = UserGuideEntry.objects.get(slug=slug)
58
    entry = get_object_or_404(Question, slug=slug)
59 59
    services = Service.objects.all()
60 60

  
61 61
    return direct_to_template(request,

Also available in: Unified diff