rewrote delete participant view as class based view

This commit is contained in:
Oskar Hahn 2012-08-10 13:29:46 +02:00
parent c029fe2f95
commit 90fddba63b
2 changed files with 17 additions and 4 deletions

View File

@ -14,7 +14,8 @@ from django.conf.urls.defaults import url, patterns
from django.core.urlresolvers import reverse
from openslides.participant.views import (
ParticipantsListPDF, ParticipantsPasswordsPDF, Overview, UserCreateView, UserUpdateView)
ParticipantsListPDF, ParticipantsPasswordsPDF, Overview, UserCreateView,
UserUpdateView, UserDeleteView)
urlpatterns = patterns('openslides.participant.views',
url(r'^$',
@ -37,8 +38,8 @@ urlpatterns = patterns('openslides.participant.views',
name='user_print',
),
url(r'^(?P<user_id>\d+)/del/$',
'user_delete',
url(r'^(?P<pk>\d+)/del/$',
UserDeleteView.as_view(),
name='user_delete',
),

View File

@ -44,7 +44,7 @@ from openslides.utils.utils import (
template, permission_required, gen_confirm_form, ajax_request, decodedict,
encodedict, delete_default_permissions, html_strong)
from openslides.utils.views import (
FormView, PDFView, TemplateView, CreateView, UpdateView)
FormView, PDFView, TemplateView, CreateView, UpdateView, DeleteView)
from openslides.config.models import config
@ -157,6 +157,9 @@ class UserCreateView(CreateView):
class UserUpdateView(UpdateView):
"""
Update an existing participant.
"""
permission_required = 'participant.can_manage_participant'
template_name = 'participant/edit.html'
model = OpenSlidesUser
@ -166,6 +169,15 @@ class UserUpdateView(UpdateView):
apply_url = 'participant_edit'
class UserDeleteView(DeleteView):
"""
Delete an participant.
"""
permission_required = 'participant.can_manage_participant'
model = OpenSlidesUser
url = 'user_overview'
@permission_required('participant.can_manage_participant')
@template('confirm.html')
def user_delete(request, user_id):