foerderbarometer/input/views.py

22 lines
685 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
from .forms import ProjectForm
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__')
2020-09-29 07:53:29 +00:00
if request.method == 'POST':
form = ProjectForm(request.POST, request.FILES)
if form.is_valid():
form.save()
2020-09-29 07:53:29 +00:00
# do something.
else:
form = ProjectForm()
return render(request, 'input/project.html', {'form': form})
2020-09-29 09:08:16 +00:00
def done(request):
return HttpResponse("Your data is save now.")