Skip to content

Instantly share code, notes, and snippets.

@maciejgryka
Created March 5, 2014 19:30
Show Gist options
  • Save maciejgryka/9374746 to your computer and use it in GitHub Desktop.
Save maciejgryka/9374746 to your computer and use it in GitHub Desktop.
from django.shortcuts import render, redirect
from core.forms import StudyForm
def study_create(request, template='core/study_form.html'):
if request.method == 'POST':
form = StudyForm(request.POST)
if form.is_valid():
study = form.save()
return redirect('study_list')
else:
form = StudyForm()
return render(request, template, {
'form': form
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment