mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 03:43:12 +00:00
Fix preferences/edit_options/OptionalUser
This commit is contained in:
parent
b5df319bc4
commit
d1a17ff763
1 changed files with 28 additions and 29 deletions
|
@ -79,12 +79,14 @@ def display_options(request):
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@permission_required('admin')
|
|
||||||
def edit_options(request, section):
|
def edit_options(request, section):
|
||||||
""" Edition des préférences générales"""
|
""" Edition des préférences générales"""
|
||||||
model = getattr(models, section, None)
|
model = getattr(models, section, None)
|
||||||
form_instance = getattr(forms, 'Edit' + section + 'Form', None)
|
form_instance = getattr(forms, 'Edit' + section + 'Form', None)
|
||||||
if model and form:
|
if not (model or form_instance):
|
||||||
|
messages.error(request, "Objet inconnu")
|
||||||
|
return redirect(reverse('preferences:display-options'))
|
||||||
|
|
||||||
options_instance, _created = model.objects.get_or_create()
|
options_instance, _created = model.objects.get_or_create()
|
||||||
can, msg = options_instance.can_edit(request.user)
|
can, msg = options_instance.can_edit(request.user)
|
||||||
if not can:
|
if not can:
|
||||||
|
@ -111,9 +113,6 @@ def edit_options(request, section):
|
||||||
'preferences/edit_preferences.html',
|
'preferences/edit_preferences.html',
|
||||||
request
|
request
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
messages.error(request, "Objet inconnu")
|
|
||||||
return redirect(reverse('preferences:display-options'))
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
|
Loading…
Reference in a new issue