From 5a7b743c8366e3120418e15f93e598e86e24a624 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Thu, 6 Apr 2017 23:29:43 +0200 Subject: [PATCH 1/3] Try fix right issues in counter admin --- counter/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/counter/views.py b/counter/views.py index 8981bfda..7e2d1daf 100644 --- a/counter/views.py +++ b/counter/views.py @@ -74,11 +74,10 @@ class CounterAdminMixin(View): def dispatch(self, request, *args, **kwargs): - res = super(CounterAdminMixin, self).dispatch(request, *args, **kwargs) if not (request.user.is_root or self._test_group(request.user) or self._test_club(request.user)): raise PermissionDenied - return res + return super(CounterAdminMixin, self).dispatch(request, *args, **kwargs) class GetUserForm(forms.Form): """ From 7cb9ea40ac30e58411f4f36e4f64466a00ac094d Mon Sep 17 00:00:00 2001 From: klmp200 Date: Fri, 14 Apr 2017 15:38:54 +0200 Subject: [PATCH 2/3] Anonymous users can't edit weekmail --- com/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com/views.py b/com/views.py index b4b473d4..4597a71d 100644 --- a/com/views.py +++ b/com/views.py @@ -348,7 +348,7 @@ class WeekmailArticleEditView(ComTabsMixin, QuickNotifMixin, CanEditPropMixin, U quick_notif_url_arg = "qn_weekmail_article_edit" current_tab = "weekmail" -class WeekmailArticleCreateView(QuickNotifMixin, CreateView): #XXX need to protect this view +class WeekmailArticleCreateView(QuickNotifMixin, CanViewMixin, CreateView): #XXX need to protect this view """Post an article""" model = WeekmailArticle fields = ['title', 'club', 'content'] From 2ef3c0260ac9482b02b521946f905e9ec4d233f1 Mon Sep 17 00:00:00 2001 From: klmp200 Date: Sat, 6 May 2017 21:15:44 +0200 Subject: [PATCH 3/3] Fix error on accounting when no target_type specified --- accounting/views.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/accounting/views.py b/accounting/views.py index c70de381..76452292 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -304,14 +304,15 @@ class OperationForm(forms.ModelForm): def clean(self): self.cleaned_data = super(OperationForm, self).clean() - if self.cleaned_data['target_type'] == "USER": - self.cleaned_data['target_id'] = self.cleaned_data['user'].id - elif self.cleaned_data['target_type'] == "ACCOUNT": - self.cleaned_data['target_id'] = self.cleaned_data['club_account'].id - elif self.cleaned_data['target_type'] == "CLUB": - self.cleaned_data['target_id'] = self.cleaned_data['club'].id - elif self.cleaned_data['target_type'] == "COMPANY": - self.cleaned_data['target_id'] = self.cleaned_data['company'].id + if 'target_type' in self.cleaned_data.keys(): + if self.cleaned_data['target_type'] == "USER": + self.cleaned_data['target_id'] = self.cleaned_data['user'].id + elif self.cleaned_data['target_type'] == "ACCOUNT": + self.cleaned_data['target_id'] = self.cleaned_data['club_account'].id + elif self.cleaned_data['target_type'] == "CLUB": + self.cleaned_data['target_id'] = self.cleaned_data['club'].id + elif self.cleaned_data['target_type'] == "COMPANY": + self.cleaned_data['target_id'] = self.cleaned_data['company'].id return self.cleaned_data def save(self):