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.

30 lines
906 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 intern(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. print('POST detected')
  11. form = ProjectForm(request.POST, request.FILES)
  12. if form.is_valid():
  13. print('form valid')
  14. form.save()
  15. # do something.
  16. else:
  17. print("form not valid")
  18. else:
  19. print
  20. form = ProjectForm()
  21. return render(request, 'input/project.html', {'form': form})
  22. def done(request):
  23. return HttpResponse("Your data is save now.")
  24. def extern(request):
  25. return HttpResponse("The world out there is large and dangerous")