Created
June 6, 2016 22:45
-
-
Save gollum23/06e64f516841647a6842416847ff322b 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
def proyecto_nuevo(request): | |
if request.method == 'POST': | |
formProyecto = ProyectForm(request.POST) | |
formImage = ImageForm(request.POST, request.FILES) | |
if formProyecto.is_valid() and formImage.is_valid():\ | |
proyecto = formProyecto.save() | |
imagen = formImage.save(commit=False) | |
imagen.proyecto = proyecto.id | |
image.save() | |
return HttpResponseRedirect('url') | |
formProyecto = ProyectForm() | |
formImage = ImageForm() | |
data = { | |
'formProyecto': formProyecto, | |
'formImage': formImage | |
} | |
return render(request, 'plantilla.html', data) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment