Last active
August 29, 2015 14:02
-
-
Save ksze/5f523f1c8fb57e432640 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_employees(request): | |
# Some preparation... (skipped) | |
success_msg = '' | |
roles = get_roles() | |
if request.method == 'POST': | |
form = EmployeeForm(request.POST, roles=roles) | |
if form.is_valid(): | |
# add the employees... (details omitted) | |
success_msg = 'yay' | |
# re-initialize the form | |
form = EmployeeForm(roles=roles) | |
else: | |
form = EmployeeForm(roles=roles) | |
return render( | |
request, | |
'path/to/template.html', | |
'form': form, | |
'success_msg': success_msg, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment