jquery - Do I need to create separate forms for simple and Ajax thing in Django -
i have many forms working fine if load them via normal http link.
the template below
{% extends "app/base.html" %} {% block title %}create account{% endblock %} {% block media %} {% include "app/media_template.html" %} {% endblock %} {% block heading %}form{% endblock %} {% block content %} <div id="stylized" class="myform"> <form action="" method="post" enctype="multipart/form-data" > <h1>account form</h1> <p>this basic of form without table</p> {% csrf_token %} {% field in form %} {{ field.errors }} {{ field.label_tag }} {{ field }} {% endfor %} <button type="submit">sign-up</button> <div class="spacer"></div> </form> </div> {% endblock %}
but if have display via ajax need div
box containing form , don't nedd other html
so want if js not working forms still work via hyperlink.
i have 6 forms , have create seoarate templae if call via ajax
if need use part of template in several places, can put part in separate template, , include wherever need:
{% include "foo/bar.html" %}
https://docs.djangoproject.com/en/dev/ref/templates/builtins/?from=olddocs#include
Comments
Post a Comment