forked from DGNum/gestioCOF
Correctifs
This commit is contained in:
parent
55fd10f9d4
commit
70eab07b8b
1 changed files with 7 additions and 13 deletions
|
@ -44,7 +44,7 @@ def account(request):
|
|||
@login_required
|
||||
@permission_required('kfet.is_team')
|
||||
def account_is_validandfree_ajax(request):
|
||||
if not request.GET.get("trigramme"):
|
||||
if not request.GET.get("trigramme", ''):
|
||||
raise Http404
|
||||
trigramme = request.GET.get("trigramme")
|
||||
data = Account.is_validandfree(trigramme)
|
||||
|
@ -118,7 +118,7 @@ def account_create_ajax(request, username=None, login_clipper=None):
|
|||
user = None
|
||||
if login_clipper:
|
||||
# à partir d'un clipper
|
||||
# le user associé à ce clipper ne devrait pas encore existé
|
||||
# le user associé à ce clipper ne devrait pas encore exister
|
||||
clipper = get_object_or_404(Clipper, username = login_clipper)
|
||||
try:
|
||||
# Vérification que clipper ne soit pas déjà dans User
|
||||
|
@ -132,7 +132,7 @@ def account_create_ajax(request, username=None, login_clipper=None):
|
|||
# UserForm - Prefill + Création
|
||||
user_initial_data = {
|
||||
'username' : login_clipper,
|
||||
'email' : login_clipper + "@clipper.ens.fr"}
|
||||
'email' : "%s@clipper.ens.fr" % login_clipper}
|
||||
if clipper.fullname:
|
||||
# Prefill du nom et prénom
|
||||
names = clipper.fullname.split()
|
||||
|
@ -180,10 +180,7 @@ def account_create_ajax(request, username=None, login_clipper=None):
|
|||
|
||||
@login_required
|
||||
def account_read(request, trigramme):
|
||||
try:
|
||||
account = Account.objects.get(trigramme=trigramme)
|
||||
except Account.DoesNotExist:
|
||||
raise Http404
|
||||
account = get_object_or_404(Account, trigramme=trigramme)
|
||||
|
||||
# Checking permissions
|
||||
if not request.user.has_perm('kfet.is_team') \
|
||||
|
@ -196,10 +193,7 @@ def account_read(request, trigramme):
|
|||
|
||||
@login_required
|
||||
def account_update(request, trigramme):
|
||||
try:
|
||||
account = Account.objects.get(trigramme=trigramme)
|
||||
except Account.DoesNotExist:
|
||||
raise Http404
|
||||
account = get_object_or_404(Account, trigramme=trigramme)
|
||||
|
||||
# Checking permissions
|
||||
if not request.user.has_perm('kfet.is_team') \
|
||||
|
@ -278,7 +272,7 @@ class CheckoutCreate(SuccessMessageMixin, CreateView):
|
|||
# Surcharge de la validation
|
||||
def form_valid(self, form):
|
||||
# Checking permission
|
||||
if not self.request.user.has_perm('add_checkout'):
|
||||
if not self.request.user.has_perm('kfet.add_checkout'):
|
||||
raise PermissionDenied
|
||||
# Creating
|
||||
form.instance.created_by = self.request.user.profile.account_kfet
|
||||
|
@ -302,7 +296,7 @@ class CheckoutUpdate(SuccessMessageMixin, UpdateView):
|
|||
# Surcharge de la validation
|
||||
def form_valid(self, form):
|
||||
# Checking permission
|
||||
if not self.request.user.has_perm('change_checkout'):
|
||||
if not self.request.user.has_perm('kfet.change_checkout'):
|
||||
raise PermissionDenied
|
||||
# Updating
|
||||
return super(CheckoutUpdate, self).form_valid(form)
|
||||
|
|
Loading…
Reference in a new issue