@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:
# 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
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)