1
0
Fork 0
foerderbarometer/input/views.py

21 lines
676 B
Python
Raw Normal View History

2020-09-21 12:27:16 +00:00
from django.shortcuts import render
2020-09-29 07:53:29 +00:00
from django.forms import modelformset_factory
from .models import Project
2020-09-29 09:08:16 +00:00
from django.http import HttpResponse
2020-09-22 10:21:05 +00:00
def index(request):
2020-09-29 07:53:29 +00:00
# return HttpResponse("Hello, world. You're at the input form")
ProjectFormSet = modelformset_factory(Project, fields='__all__')
if request.method == 'POST':
formset = ProjectFormSet(request.POST, request.FILES)
if formset.is_valid():
formset.save()
# do something.
else:
formset = ProjectFormSet()
return render(request, 'input/project.html', {'formset': formset})
2020-09-29 09:08:16 +00:00
def done(request):
return HttpResponse("Your data is save now.")