You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
685 B

4 years ago
  1. from django.shortcuts import render
  2. from django.forms import modelformset_factory
  3. from .models import Project
  4. from .forms import ProjectForm
  5. from django.http import HttpResponse
  6. def index(request):
  7. # return HttpResponse("Hello, world. You're at the input form")
  8. # ProjectFormSet = modelformset_factory(Project, fields='__all__')
  9. if request.method == 'POST':
  10. form = ProjectForm(request.POST, request.FILES)
  11. if form.is_valid():
  12. form.save()
  13. # do something.
  14. else:
  15. form = ProjectForm()
  16. return render(request, 'input/project.html', {'form': form})
  17. def done(request):
  18. return HttpResponse("Your data is save now.")