Fixed missing form invalid error message.
This commit is contained in:
parent
511ee7298d
commit
72de1dce74
@ -176,6 +176,8 @@ def edit(request, application_id=None):
|
|||||||
return redirect(reverse('application_view', args=[application.id]))
|
return redirect(reverse('application_view', args=[application.id]))
|
||||||
if application_id is None:
|
if application_id is None:
|
||||||
return redirect(reverse('application_edit', args=[application.id]))
|
return redirect(reverse('application_edit', args=[application.id]))
|
||||||
|
else:
|
||||||
|
messages.error(request, _('Please check the form for errors.'))
|
||||||
else:
|
else:
|
||||||
if application_id is None:
|
if application_id is None:
|
||||||
initial = {'text': config_get('application_preamble')}
|
initial = {'text': config_get('application_preamble')}
|
||||||
|
@ -114,6 +114,8 @@ def edit(request, assignment_id=None):
|
|||||||
return redirect(reverse("assignment_overview"))
|
return redirect(reverse("assignment_overview"))
|
||||||
if assignment_id is None:
|
if assignment_id is None:
|
||||||
return redirect(reverse('assignment_edit', args=[assignment.id]))
|
return redirect(reverse('assignment_edit', args=[assignment.id]))
|
||||||
|
else:
|
||||||
|
messages.error(request, _('Please check the form for errors.'))
|
||||||
else:
|
else:
|
||||||
form = AssignmentForm(instance=assignment)
|
form = AssignmentForm(instance=assignment)
|
||||||
return {
|
return {
|
||||||
|
@ -109,7 +109,7 @@ def get_overview(request):
|
|||||||
@template('participant/edit.html')
|
@template('participant/edit.html')
|
||||||
def edit(request, user_id=None):
|
def edit(request, user_id=None):
|
||||||
"""
|
"""
|
||||||
View zum editieren und neuanlegen von Usern mit Profile
|
View to create and edit users with profile.
|
||||||
"""
|
"""
|
||||||
if user_id is not None:
|
if user_id is not None:
|
||||||
user = User.objects.get(id=user_id)
|
user = User.objects.get(id=user_id)
|
||||||
@ -124,7 +124,7 @@ def edit(request, user_id=None):
|
|||||||
userform = UserEditForm(request.POST, instance=user, prefix="user")
|
userform = UserEditForm(request.POST, instance=user, prefix="user")
|
||||||
profileform = ProfileForm(request.POST, instance=user.profile, prefix="profile")
|
profileform = ProfileForm(request.POST, instance=user.profile, prefix="profile")
|
||||||
|
|
||||||
if userform.is_valid and profileform.is_valid:
|
if userform.is_valid() and profileform.is_valid():
|
||||||
user = userform.save()
|
user = userform.save()
|
||||||
if user_id is None:
|
if user_id is None:
|
||||||
user.username = gen_username(user.first_name, user.last_name)
|
user.username = gen_username(user.first_name, user.last_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user