delete item, not application by releated agenda-items

This commit is contained in:
Oskar Hahn 2012-06-03 10:19:08 +02:00
parent 2e498403cb
commit 43e30057b3
3 changed files with 9 additions and 7 deletions

View File

@ -112,11 +112,13 @@ class Item(MPTTModel, SlideMixin):
* view
* delete
"""
if self.releated_sid:
return self.get_releated_slide().get_absolute_url(link)
if link == 'view':
if self.releated_sid:
return self.get_releated_slide().get_absolute_url(link)
return reverse('item_view', args=[str(self.id)])
if link == 'edit':
if self.releated_sid:
return self.get_releated_slide().get_absolute_url(link)
return reverse('item_edit', args=[str(self.id)])
if link == 'delete':
return reverse('item_delete', args=[str(self.id)])

View File

@ -124,13 +124,13 @@ def overview(request):
# is not callable from within djangos templates..
for (i, application) in enumerate(applications):
try:
applications[i] = {
applications[i] = {
'actions' : application.get_allowed_actions(request.user),
'application' : application
}
except:
# todo: except what?
applications[i] = {
applications[i] = {
'actions' : [],
'application' : application
}
@ -463,7 +463,7 @@ class ApplicationDelete(DeleteView):
def gen_confirm_form(self, request, message, url):
formbase = '%s<form action="%s" method="post"><input type="hidden" value="%s" name="csrfmiddlewaretoken">' % (message, url, csrf(request)['csrf_token'])
if len(self.applications):
for application in self.applications:
formbase += '<input type="hidden" name="application_ids" value="%s">' % application.id
@ -668,7 +668,7 @@ class CreateAgendaItem(RedirectView):
self.item.save()
def get_redirect_url(self, **kwargs):
return reverse('item_view', args=[self.item.id])
return reverse('item_overview')
class ApplicationPDF(PDFView):

View File

@ -41,7 +41,7 @@ def get_slide_from_sid(sid, element=False):
if id is not None:
try:
object = SLIDE[key].model.objects.get(pk=id)
except SLIDE[key].DoesNotExist:
except SLIDE[key].model.DoesNotExist:
return None
if element:
return object