Matmat renames

This commit is contained in:
Antoine Bartuccio 2017-07-24 12:33:34 +02:00
parent dc571836ae
commit a9e23920ee
3 changed files with 8 additions and 8 deletions

View File

@ -144,14 +144,14 @@ class CanViewMixin(View):
return super(CanViewMixin, self).dispatch(request, *arg, **kwargs) return super(CanViewMixin, self).dispatch(request, *arg, **kwargs)
class WasSuscribed(View): class FormerSubscriberMixin(View):
""" """
This view check if the user was at least an old subscriber This view check if the user was at least an old subscriber
""" """
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
if not request.user.was_subscribed: if not request.user.was_subscribed:
raise PermissionDenied raise PermissionDenied
return super(WasSuscribed, self).dispatch(request, *args, **kwargs) return super(FormerSubscriberMixin, self).dispatch(request, *args, **kwargs)
class TabedViewMixin(View): class TabedViewMixin(View):

View File

@ -1,7 +1,7 @@
# -*- coding:utf-8 -* # -*- coding:utf-8 -*
# #
# Copyright 2017 # Copyright 2017
# - Sli <skia@libskia.so> # - Sli <antoine@bartuccio.fr>
# #
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, # Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
# http://ae.utbm.fr. # http://ae.utbm.fr.

View File

@ -1,7 +1,7 @@
# -*- coding:utf-8 -* # -*- coding:utf-8 -*
# #
# Copyright 2017 # Copyright 2017
# - Sli <skia@libskia.so> # - Sli <antoine@bartuccio.fr>
# #
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, # Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
# http://ae.utbm.fr. # http://ae.utbm.fr.
@ -33,7 +33,7 @@ from django.core.urlresolvers import reverse
from django import forms from django import forms
from core.models import User from core.models import User
from core.views import WasSuscribed from core.views import FormerSubscriberMixin
from core.views.forms import SelectDate from core.views.forms import SelectDate
from core.views import search_user from core.views import search_user
from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget
@ -93,7 +93,7 @@ class SearchForm(forms.ModelForm):
# Views # Views
class SearchFormListView(WasSuscribed, SingleObjectMixin, ListView): class SearchFormListView(FormerSubscriberMixin, SingleObjectMixin, ListView):
model = User model = User
ordering = ["-id"] ordering = ["-id"]
paginate_by = 12 paginate_by = 12
@ -159,7 +159,7 @@ class SearchFormListView(WasSuscribed, SingleObjectMixin, ListView):
return q return q
class SearchFormView(WasSuscribed, FormView): class SearchFormView(FormerSubscriberMixin, FormView):
""" """
Allows users to search inside the user list Allows users to search inside the user list
""" """
@ -203,7 +203,7 @@ class SearchQuickFormView(SearchFormView):
search_type = SearchType.QUICK search_type = SearchType.QUICK
class SearchClearFormView(WasSuscribed, View): class SearchClearFormView(FormerSubscriberMixin, View):
""" """
Clear SearchFormView and redirect to it Clear SearchFormView and redirect to it
""" """