Skip to content

Instantly share code, notes, and snippets.

@malgorath
Last active August 29, 2015 14:20
Show Gist options
  • Save malgorath/0b1c8381137a4db53ef2 to your computer and use it in GitHub Desktop.
Save malgorath/0b1c8381137a4db53ef2 to your computer and use it in GitHub Desktop.
How to include a form.html in any other type of .html file in DJANGO
<form action="/form/submit" method="POST">
<strong>I.Q.:</strong>
<input type="text" name="IQ" />
<input type="submit" value="Send My IQ" />
</form>
Hi I like to do things in colors, but I'm not so smart. Whats your IQ?
{% include 'form.html' %}
from django.conf.urls import include, url
urlpatterns = [
url(r'^$', views.home, name='home'),
url(r'^form/submit$', views.submit, name='send-form'),
]
from django.shortcuts import render
def home(request):
return render(request, 'home/index.html', {})
def submit(request):
// do your noraml form submission here only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment