Created
January 24, 2016 13:12
-
-
Save TarasTarasTaras/ca288ab666c1db1aee7c 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_serie(request): | |
context = { | |
'serie_form': AddSerieForm() | |
} | |
if request.POST and request.user.is_authenticated(): | |
add_serie_form = AddSerieForm(request.POST) | |
if add_serie_form.is_valid(): | |
serie = add_serie_form.save(commit=False) | |
serie[creator] = request.user.guidauser | |
serie.save() | |
add_serie_form.save() | |
return redirect(reverse('main:serie', kwargs={'serie_id': serie.id})) | |
else: | |
context['serie_form'] = add_serie_form | |
return render(request, 'serie/add_serie.html', context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment