mirror of
				https://github.com/ae-utbm/sith.git
				synced 2025-11-04 11:03:04 +00:00 
			
		
		
		
	Merge branch 'bugfix' into 'master'
Fix crash when no target_type specified on accounting Il y a aussi d'autres commit que j'ai oublié de faire merge See merge request !71
This commit is contained in:
		@@ -304,6 +304,7 @@ class OperationForm(forms.ModelForm):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def clean(self):
 | 
					    def clean(self):
 | 
				
			||||||
        self.cleaned_data = super(OperationForm, self).clean()
 | 
					        self.cleaned_data = super(OperationForm, self).clean()
 | 
				
			||||||
 | 
					        if 'target_type' in self.cleaned_data.keys():
 | 
				
			||||||
            if self.cleaned_data['target_type'] == "USER":
 | 
					            if self.cleaned_data['target_type'] == "USER":
 | 
				
			||||||
                self.cleaned_data['target_id'] = self.cleaned_data['user'].id
 | 
					                self.cleaned_data['target_id'] = self.cleaned_data['user'].id
 | 
				
			||||||
            elif self.cleaned_data['target_type'] == "ACCOUNT":
 | 
					            elif self.cleaned_data['target_type'] == "ACCOUNT":
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -348,7 +348,7 @@ class WeekmailArticleEditView(ComTabsMixin, QuickNotifMixin, CanEditPropMixin, U
 | 
				
			|||||||
    quick_notif_url_arg = "qn_weekmail_article_edit"
 | 
					    quick_notif_url_arg = "qn_weekmail_article_edit"
 | 
				
			||||||
    current_tab = "weekmail"
 | 
					    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"""
 | 
					    """Post an article"""
 | 
				
			||||||
    model = WeekmailArticle
 | 
					    model = WeekmailArticle
 | 
				
			||||||
    fields = ['title', 'club', 'content']
 | 
					    fields = ['title', 'club', 'content']
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,11 +74,10 @@ class CounterAdminMixin(View):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def dispatch(self, request, *args, **kwargs):
 | 
					    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)
 | 
					        if not (request.user.is_root or self._test_group(request.user)
 | 
				
			||||||
                or self._test_club(request.user)):
 | 
					                or self._test_club(request.user)):
 | 
				
			||||||
            raise PermissionDenied
 | 
					            raise PermissionDenied
 | 
				
			||||||
        return res
 | 
					        return super(CounterAdminMixin, self).dispatch(request, *args, **kwargs)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class GetUserForm(forms.Form):
 | 
					class GetUserForm(forms.Form):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user