Making Forms Crispier than Potato Chips with Django-Crispy-Forms

What on earth are Django-crispy-forms?

How does Django play?

  • A filter called |crispy | that will render neat div based forms. You can imagine it as the built-in methods: as_table, as_ul and as_p. The output cannot be tuned up, but it can be easily launched to life.
  • A tag named {% crispy %} will render a form which is tailored to developer’s configuration and particular layout setup. This gives computer gurus lots of “super-powers” without much hassle, helping them to save loads of time.

The boons of Django-crispy-forms

Installing Django-crispy-forms is a piece of cake

How Django crispy forms layout saves the day

Welcome to the world of universal layout objects

  • Div: It wraps fields in a <div>:
  • HTML: It’s quite a powerful layout object. It should be used to render pure HTML code. In essence, it acts as a Django template. HTML has access to the overall context of the page where the form is being rendered.
  • Field: A principle layout object. It can be used for setting attributes in a field or rendering a particular field with a custom template. That is how the necessity to override the field’s widget can be avoided. That is the way to pass over a weird attrsdictionary:
  • Submit: Used to help to create submit button. There are two parameters. The first one is the name attribute of this very button. The second one is the value attribute:
  • Hidden: was creating a hidden input:
  • Button: for creating a button:
  • Reset: was used to create a reset input:
  • Fieldset: It wraps fields in a <fieldset>. The first attribute is the command line for the fieldset legend. As indicated earlier, it acts as a Django template:

Final thoughts



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


Onix-Systems provides IT services in website, mobile app and emerging technologies software development. Check our blog ->