Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
6df7ad37
Verified
Commit
6df7ad37
authored
Feb 18, 2019
by
Sébastiaan Versteeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add permissions to admin views
parent
1a93780a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
website/events/admin_views.py
website/events/admin_views.py
+9
-4
No files found.
website/events/admin_views.py
View file @
6df7ad37
import
csv
from
django.contrib.admin.views.decorators
import
staff_member_required
from
django.contrib.auth.mixins
import
PermissionRequiredMixin
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
get_object_or_404
from
django.urls
import
reverse
...
...
@@ -18,22 +19,24 @@ from .models import Event, Registration
@
method_decorator
([
staff_member_required
,
],
name
=
'dispatch'
)
@
method_decorator
(
organiser_only
,
name
=
'dispatch'
)
class
EventAdminDetails
(
DetailView
):
class
EventAdminDetails
(
DetailView
,
PermissionRequiredMixin
):
"""
Renders an overview of registrations for the specified event
"""
template_name
=
'events/admin/details.html'
model
=
Event
context_object_name
=
'event'
permission_required
=
'events.change_event'
@
method_decorator
([
staff_member_required
,
],
name
=
'dispatch'
)
@
method_decorator
(
organiser_only
,
name
=
'dispatch'
)
class
EventRegistrationsExport
(
View
):
class
EventRegistrationsExport
(
View
,
PermissionRequiredMixin
):
"""
View to export registrations
"""
template_name
=
'events/admin/details.html'
permission_required
=
'events.change_event'
def
get
(
self
,
request
,
pk
):
"""
...
...
@@ -124,12 +127,13 @@ class EventRegistrationsExport(View):
@
method_decorator
([
staff_member_required
,
],
name
=
'dispatch'
)
@
method_decorator
(
organiser_only
,
name
=
'dispatch'
)
class
EventRegistrationEmailsExport
(
TemplateView
):
class
EventRegistrationEmailsExport
(
TemplateView
,
PermissionRequiredMixin
):
"""
Renders a page that outputs all email addresses of registered members
for an event
"""
template_name
=
'events/admin/email_export.html'
permission_required
=
'events.view_event'
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
...
...
@@ -147,12 +151,13 @@ class EventRegistrationEmailsExport(TemplateView):
@
method_decorator
([
staff_member_required
,
],
name
=
'dispatch'
)
@
method_decorator
(
organiser_only
,
name
=
'dispatch'
)
class
EventRegistrationsMarkPresent
(
View
):
class
EventRegistrationsMarkPresent
(
View
,
PermissionRequiredMixin
):
"""
Renders a page that outputs all email addresses of registered members
for an event
"""
template_name
=
'events/admin/email_export.html'
permission_required
=
'events.change_registration'
def
get
(
self
,
request
,
pk
):
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment