Last active
August 17, 2018 00:05
-
-
Save converge/651f4689cb505668d780a3ddcb60a795 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# VIEW | |
def setup_schedule(request): | |
if request.method == 'POST': | |
form = SetupScheduleForm(request.POST) | |
context = {'setup_schedule_form': form} | |
if form.is_valid(): | |
form.save() | |
return redirect('/setup', context) | |
else: | |
form = SetupScheduleForm(instance=None) | |
context = {'setup_schedule_form': form} | |
return render(request, 'igbot_setup.html', context) | |
# TEMPLATE | |
<form class="" action="{% url 'igbot:setup_schedule' %}" method="post"> | |
{% csrf_token %} {% for field in setup_schedule_form %} | |
{{ field.errors }} | |
<div class="form-group"> | |
{{ field.label_tag }} {{ field }} | |
</div> | |
{% endfor %} | |
<div class="form-actions form-group"> | |
<input type="submit" value="Save" class="btn btn-success btn-sm"> | |
</div> | |
<input type="hidden" name="next" value="{{ next }}"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment