Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def Insert(request):
- if request.method == 'POST':
- form = insertForm(request.POST, prefix='insert')
- print(request.POST)
- print(form)
- if form.is_valid():
- person = form.cleaned_data['person']
- location = form.cleaned_data['location']
- name = form.cleaned_data['name']
- sighted = form.cleaned_data['sighted']
- connection.cursor().execute("INSERT INTO GUI_sightings(person, location, name_id, sighted) VALUES( %s, %s, %s, %s)", (person, location, name, sighted))
- return HttpResponseRedirect('/')
- else:
- return render(request, 'GUI/insert.html', {'form': form})
- else:
- form = insertForm()
- return render(request, 'GUI/insert.html', {'form': form})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement