python
pip install django-remote-forms
python
INSTALLED_APPS = [
...
'dajaxice',
'remote_forms',
...
]
python
urlpatterns = [
...
url(dajaxice_config.dajaxice_url, include('dajaxice.urls')),
...
]
python
from django.views.generic.edit import FormView
from remote_forms.forms import RemoteForm
class MyFormView(FormView):
template_name = 'my_template.html'
form_class = RemoteForm
success_url = 'success/'
def form_valid(self, form):
return self.render_to_http_response('success.html')
html
<form method="POST">
{% csrf_token %}
{{ form }}
<input type="submit" value="Submit">
</form>