Last active
August 29, 2015 14:20
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form action="/form/submit" method="POST"> | |
<strong>I.Q.:</strong> | |
<input type="text" name="IQ" /> | |
<input type="submit" value="Send My IQ" /> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi I like to do things in colors, but I'm not so smart. Whats your IQ? | |
{% include 'form.html' %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf.urls import include, url | |
urlpatterns = [ | |
url(r'^$', views.home, name='home'), | |
url(r'^form/submit$', views.submit, name='send-form'), | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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