Browse Source

submit leads to the done() view now

master
Benni Baermann 4 years ago
parent
commit
b740838b13
3 changed files with 6 additions and 3 deletions
  1. +1
    -1
      input/templates/input/project.html
  2. +1
    -0
      input/urls.py
  3. +4
    -2
      input/views.py

+ 1
- 1
input/templates/input/project.html View File

@ -1,4 +1,4 @@
<form action="/your-name/" method="post">
<form action="saved" method="post">
{% csrf_token %} {% csrf_token %}
{{ formset }} {{ formset }}
<input type="submit" value="Submit"> <input type="submit" value="Submit">

+ 1
- 0
input/urls.py View File

@ -4,4 +4,5 @@ from . import views
urlpatterns = [ urlpatterns = [
path('', views.index, name='index'), path('', views.index, name='index'),
path('saved', views.done, name='done')
] ]

+ 4
- 2
input/views.py View File

@ -1,8 +1,7 @@
from django.shortcuts import render from django.shortcuts import render
from django.forms import modelformset_factory from django.forms import modelformset_factory
from .models import Project from .models import Project
# Create your views here.
# from django.http import HttpResponse
from django.http import HttpResponse
def index(request): def index(request):
@ -16,3 +15,6 @@ def index(request):
else: else:
formset = ProjectFormSet() formset = ProjectFormSet()
return render(request, 'input/project.html', {'formset': formset}) return render(request, 'input/project.html', {'formset': formset})
def done(request):
return HttpResponse("Your data is save now.")

Loading…
Cancel
Save