From 773a8c2da4c355af5d81d27a4849e9548e2d8864 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 10 Oct 2012 14:00:27 +0200 Subject: [PATCH] minor fixes --- menu/helpers.py | 2 +- migdal/views.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/menu/helpers.py b/menu/helpers.py index 2a5df9d..e22bb97 100755 --- a/menu/helpers.py +++ b/menu/helpers.py @@ -35,7 +35,7 @@ class ObjectMenuItem(MenuItem): @property def get_url(self): - return self.url or self.get_obj().get_absolute_url() + return self.url or self.obj.get_absolute_url() def is_active(self, request, value): if value == self.obj: diff --git a/migdal/views.py b/migdal/views.py index d8652c7..1f769a9 100644 --- a/migdal/views.py +++ b/migdal/views.py @@ -2,6 +2,7 @@ # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # +from django.http import Http404 from django.shortcuts import get_object_or_404, render, redirect from django.utils.translation import get_language from fnpdjango.utils.views import set_current_object @@ -60,7 +61,7 @@ def entry(request, type_db=None, slug=None, entry=None): lang = request.LANGUAGE_CODE args = {'type': type_db, 'slug_%s' % lang: slug} entry = get_object_or_404(Entry, **args) - if request.user.has_perm('migdal.change_entry') or not entry.published: + if not entry.published and not request.user.has_perm('migdal.change_entry'): raise Http404 set_current_object(request, entry, in_url=slug is not None) -- 2.20.1