From f15f878508c3a3149b20c418fcf13ee1d6e4ab52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sat, 18 Aug 2018 16:35:21 +0200 Subject: [PATCH] Add a proposal edit permission. --- src/backoffice/templates/index.html | 11 +++++++---- src/backoffice/views.py | 6 +++++- .../migrations/0067_auto_20180818_1634.py | 17 +++++++++++++++++ src/program/models.py | 5 +++++ 4 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 src/program/migrations/0067_auto_20180818_1634.py diff --git a/src/backoffice/templates/index.html b/src/backoffice/templates/index.html index d331cf63..67760f5d 100644 --- a/src/backoffice/templates/index.html +++ b/src/backoffice/templates/index.html @@ -29,15 +29,18 @@ {% endif %} + {% if perms.program.can_approve_proposals %} + +

Manage Proposals

+

Use this view to manage SpeakerProposals and EventProposals

+
+ {% endif %} + {% if user.is_superuser %}

Approve Public Credit Names

Use this view to check and approve users Public Credit Names

- -

Manage Proposals

-

Use this view to manage SpeakerProposals and EventProposals

-

Merchandise Orders

Use this view to look at Merchandise Orders

diff --git a/src/backoffice/views.py b/src/backoffice/views.py index d9afd05b..287a12b6 100644 --- a/src/backoffice/views.py +++ b/src/backoffice/views.py @@ -23,6 +23,10 @@ class InfodeskMixin(CampViewMixin, PermissionRequiredMixin): permission_required = ("camps.infodesk_permission") +class ContentTeamMixin(CampViewMixin, PermissionRequiredMixin): + permission_required = ("program.can_approve_proposals") + + class BackofficeIndexView(InfodeskMixin, TemplateView): template_name = "index.html" @@ -78,7 +82,7 @@ class ApproveNamesView(BackofficeViewMixin, ListView): return Profile.objects.filter(public_credit_name_approved=False).exclude(public_credit_name='') -class ManageProposalsView(BackofficeViewMixin, ListView): +class ManageProposalsView(ContentTeamMixin, ListView): """ This view shows a list of pending SpeakerProposal and EventProposals. """ diff --git a/src/program/migrations/0067_auto_20180818_1634.py b/src/program/migrations/0067_auto_20180818_1634.py new file mode 100644 index 00000000..a03bed99 --- /dev/null +++ b/src/program/migrations/0067_auto_20180818_1634.py @@ -0,0 +1,17 @@ +# Generated by Django 2.1 on 2018-08-18 14:34 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('program', '0066_speaker_email'), + ] + + operations = [ + migrations.AlterModelOptions( + name='eventproposal', + options={'permissions': (('can_approve_proposals', 'Can approve proposals'),)}, + ), + ] diff --git a/src/program/models.py b/src/program/models.py index 37b12d11..fe5e1631 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -311,6 +311,11 @@ class SpeakerProposal(UserSubmittedModel): class EventProposal(UserSubmittedModel): """ An event proposal """ + class Meta: + permissions = ( + ("can_approve_proposals", "Can approve proposals"), + ) + track = models.ForeignKey( 'program.EventTrack', related_name='eventproposals',