{"id":728,"date":"2019-04-18T21:03:27","date_gmt":"2019-04-18T21:03:27","guid":{"rendered":"https:\/\/alternative-spaces.com\/blog\/?p=728"},"modified":"2023-05-12T09:18:41","modified_gmt":"2023-05-12T09:18:41","slug":"making-forms-crispier-than-potato-chips-with-django-crispy-forms","status":"publish","type":"post","link":"https:\/\/alternative-spaces.com\/blog\/making-forms-crispier-than-potato-chips-with-django-crispy-forms\/","title":{"rendered":"Making Forms Crispier than Potato Chips with Django-Crispy-Forms"},"content":{"rendered":"\n<p>What first comes to your mind when you hear the word \u201cDjango?\u201d Some people can&#8217;t help but think about the movie: Django Unchained, some about weird jingos. Well, it\u2019s neither jingo patriotism nor a movie \u2014 it\u2019s something that helps developers bring some style to their HTML forms without much effort or time.<\/p>\n\n\n\n<p>Let\u2019s learn how developers can polish up HTML fields with&nbsp;<a href=\"http:\/\/django-crispy-forms.rtfd.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">django-crispy-forms<\/a>.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What on earth are Django-crispy-forms?<\/strong><\/h2>\n\n\n\n<p>Django-crispy-forms is a high-level Python web framework. The primary motivation here is to encourage quick development and make an attractive design.<\/p>\n\n\n\n<p>Moreover, the Django framework was built by professional developers. It tackles the issues of web development hassles so that IT specialists can focus on creating their apps pain-free. There\u2019s no need to reinvent the wheel.&nbsp;<a href=\"https:\/\/www.djangoproject.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Django project<\/a>&nbsp;is free and open for any aspiring developer.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How does Django play?<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"466\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/Z7GxFMfCznWlJuqOQ_cI4F8-bcs_1sw8-1024x466.jpg\" alt=\"\" class=\"wp-image-729\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/Z7GxFMfCznWlJuqOQ_cI4F8-bcs_1sw8-1024x466.jpg 1024w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/Z7GxFMfCznWlJuqOQ_cI4F8-bcs_1sw8-150x68.jpg 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/Z7GxFMfCznWlJuqOQ_cI4F8-bcs_1sw8-300x136.jpg 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/Z7GxFMfCznWlJuqOQ_cI4F8-bcs_1sw8-768x349.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Django DRY (fun word for crispy) forms can help to build reusable programmatic&nbsp;layouts. Here the developer has full control of the rendered HTML without the necessity to write HTML in templates. All this can happen without breaking the standard way of doing things in Django, so it plays nice with any other form application.<\/p>\n\n\n\n<p>Django-crispy-forms is built to support Python 2.7\/Python 3.3+ and Django 1.8\/Django 1.10+<\/p>\n\n\n\n<p>The application basically gives such options:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>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.<\/li><li>A tag named {% crispy %} will render a form which is tailored to developer\u2019s configuration and particular layout setup. This gives computer gurus lots of \u201csuper-powers\u201d without much hassle, helping them to save loads of time.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The boons of Django-crispy-forms<\/strong><\/h2>\n\n\n\n<p>Django-crispy-forms helps developers bring some style to input forms\u2019 properties (i.e., method, CSS classes or \u201csend button\u201d) on the backend. The good news: these forms don\u2019t have to be re-written in the template. In this way, the plain Django forms become more readable. It is also easier to render them. The programmer can even restrict them to one life of code.<\/p>\n\n\n\n<p>More significantly, Django-crispy-forms improves the look of the forms. They add CSS classes to all the buttons, individual fields so that an entire form looks gorgeous.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Installing Django-crispy-forms is a piece of cake<\/strong><\/h2>\n\n\n\n<p>Developers need to follow a standard procedure to install django-crispy-forms. They need a pack manager \u201cpip\u201d or \u201ceasy_install.\u201d Then, they add the installed App \u2018cryspy_forms\u201d to the INSTALLED_APPS list.<\/p>\n\n\n\n<p>If the&nbsp;<a rel=\"noreferrer noopener\" href=\"http:\/\/getbootstrap.com\/2.3.2\/\" target=\"_blank\">Bootstrap<\/a>(or any other CSS framework as&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/foundation.zurb.com\/\" target=\"_blank\">Foundations)<\/a>&nbsp;is used, then it needs to be imported to the project. That\u2019s all to it. For more details and advanced options, check out <a rel=\"noreferrer noopener\" href=\"http:\/\/django-crispy-forms.readthedocs.io\/en\/latest\/\" target=\"_blank\">the official django-crispy-forms documentation<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How Django crispy forms layout saves the day<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/TqWepPJJFITLS-UM7O2JoeYbKG_OvqZZ-1024x723.jpg\" alt=\"\" class=\"wp-image-730\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/TqWepPJJFITLS-UM7O2JoeYbKG_OvqZZ-1024x723.jpg 1024w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/TqWepPJJFITLS-UM7O2JoeYbKG_OvqZZ-150x106.jpg 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/TqWepPJJFITLS-UM7O2JoeYbKG_OvqZZ-300x212.jpg 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/TqWepPJJFITLS-UM7O2JoeYbKG_OvqZZ-768x542.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Django-crispy-forms can define another strong class: Layout. This class is an excellent help for rendering the fields of a form. It opens access so that fields can be ordered and wrapped in structures. Then HTML is added, and various classes are set, etc. All of this is an excellent asset at hand for a busy programmer.&nbsp;<\/p>\n\n\n\n<p>Now the developer doesn\u2019t have to write a custom form template \u2014 no need for programmatic layouts any longer. The programmer can attach the layout to a helper. Layouts are optionally used, but the bottom line here is that they are the best stuff offered by django-crispy-forms. So they shouldn\u2019t be overlooked.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Layout objects are the building bricks for Layout. They are the DNA of the form building process.<\/p>\n\n\n\n<p>Feel free to dig deeper into it by reading about&nbsp;<a href=\"https:\/\/django-crispy-forms.readthedocs.io\/en\/1.2.1\/layouts.html#layout-objects\" target=\"_blank\" rel=\"noreferrer noopener\">Universal layout objects<\/a>. It\u2019s important to remember that a different template is generated by various components which have a different purpose.<\/p>\n\n\n\n<p>For instance, let\u2019s imagine a developer wants to have a couple of different layouts for their form. How would this form class look like in real life?&nbsp;NB: Some layout objects are tied to a particular template.<\/p>\n\n\n\n<p>Imagine ButtonHolder is for uni_formtemplate_pack, while FormActions is for bootstrap template pack. Here are some django crispy forms layout examples:&nbsp;<\/p>\n\n\n\n<p><em>from crispy_forms.helper import FormHelper<\/em><\/p>\n\n\n\n<p><em>from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit<\/em><\/p>\n\n\n\n<p><em>class ExampleForm(forms.Form):<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;[&#8230;]<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;def __init__(self, *args, **kwargs):<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.helper = FormHelper()<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.helper.layout = Layout(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fieldset(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;first arg is the legend of the fieldset&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;like_platform&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_watch&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_price&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_restaurant&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;notes&#8217;<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ButtonHolder(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Submit(&#8216;submit&#8217;, &#8216;Submit&#8217;, css_class=&#8217;button white&#8217;)<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;super(ExampleForm, self).__init__(*args, **kwargs)<\/em><\/p>\n\n\n\n<p>While rendering the form, the developers use now:<\/p>\n\n\n\n<p><em>{% load crispy_forms_tags %}<\/em><\/p>\n\n\n\n<p><em>{% crispy example_form %}<\/em><\/p>\n\n\n\n<p>What\u2019s next? The fields are included in the fieldset, whose legend will be switched to \u2018first arg is the legend of the fieldset.\u2019 The order of the fields\u2019 will be in this fashion: like_platform, favorite_watch, favorite_price, favorite_restaurant, and notes.<\/p>\n\n\n\n<p>Then the submit button can be wrapped in a &lt;div class=&#8221;buttonHolder&#8221;&gt; which Django uni-form turns from ashes to beauty. That button is under the jurisdiction of its own CSS class which is set to button white.<\/p>\n\n\n\n<p>Now, let\u2019s say the developer wants to explain the notes. In such a case HTML layout object can be used:<\/p>\n\n\n\n<p><em>Layout(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;Fieldset(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;Tell us your favorite stuff {{ username }}&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;like_platform&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_watch&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_price&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_restaurant&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HTML(&#8220;&#8221;&#8221;<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;We use notes to become smarter get better, &lt;strong&gt;please help us {{ username }}&lt;\/strong&gt;&lt;\/p&gt;<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8220;&#8221;&#8221;),<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;notes&#8217;<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;)<\/em><\/p>\n\n\n\n<p><em>)<\/em><\/p>\n\n\n\n<p>The fieldset legend is \u201ccontext-conscious,\u201d and it can be written as if it were a piece of a template (where the form will be rendered to). The HTML object will tag a message before the notes are provided. It\u2019s also \u201ccontext-aware.\u201d Layout objects such as Fieldset, Div, MultiField, and ButtonHolder can contain other Layout objects within.<\/p>\n\n\n\n<p>Let\u2019s play a bit further. This time we\u2019ll do a different layout for the same form:<\/p>\n\n\n\n<p><em>Layout(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;MultiField(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;Tell us your favorite stuff {{ username }}&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Div(<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;like_platform&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_watch&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;css_id = &#8216;special-fields&#8217;<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;),<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_price&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;favorite_restaurant&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8216;notes&#8217;<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&nbsp;)<\/em><\/p>\n\n\n\n<p><em>)<\/em><\/p>\n\n\n\n<p>This time a MultiField has been used which is a layout object. As a rule of thumb, it can be utilized in the same places as Fieldset. The difference here is: all fields can be rendered wrapped in a div. If some potential errors happen in the form submission, then they are displayed in a list farther from the field.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Welcome to the world of universal layout objects<\/strong><\/h2>\n\n\n\n<p>The layout objects are found in module crispy_forms.layout, but they are not specific to a template pack. Let\u2019s take them one by one and see their usage examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Div:<\/strong>&nbsp;It wraps fields in a&nbsp;<em>&lt;div&gt;<\/em>:<\/li><\/ul>\n\n\n\n<p><em>Div(&#8216;form_field_1&#8217;, &#8216;form_field_2&#8217;, &#8216;form_field_3&#8217;, &#8230;)<\/em><\/p>\n\n\n\n<p><strong>DISCLAIMER:<\/strong>&nbsp;There is a possibility to set kwargs in all layout objects that will be utilized as HTML attributes. The developer should use&nbsp;<em>css_class<\/em>&nbsp;as&nbsp;<em>class<\/em>&nbsp;is a keyword in Python. For example:<\/p>\n\n\n\n<p><em>Div(&#8216;form_field_1&#8217;, style=&#8221;background: white;&#8221;, title=&#8221;Explication title&#8221;, css_class=&#8221;bigdivs&#8221;)<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>HTML:<\/strong>&nbsp;It\u2019s 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.<\/li><\/ul>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Field:<\/strong>&nbsp;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\u2019s widget can be avoided. That is the way to pass over a weird&nbsp;<em>attrs<\/em>dictionary:<\/li><\/ul>\n\n\n\n<p><em>Field(&#8216;password&#8217;, id=&#8221;password-field&#8221;, css_class=&#8221;passwordfields&#8221;, title=&#8221;Explanation&#8221;)<\/em><\/p>\n\n\n\n<p><em>Field(&#8216;slider&#8217;, template=&#8221;custom-slider.html&#8221;)<\/em><\/p>\n\n\n\n<p>This layout object can be used for an easy Django\u2019s widgets extension.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Submit:<\/strong>&nbsp;Used to help to create submit button. There are two parameters. The first one is the&nbsp;<em>name<\/em>&nbsp;attribute of this very button. The second one is the&nbsp;<em>value<\/em>&nbsp;attribute:<\/li><\/ul>\n\n\n\n<p><em>Submit(&#8216;search&#8217;, &#8216;SEARCH&#8217;)<\/em><\/p>\n\n\n\n<p><em>Submit(&#8216;search&#8217;, &#8216;SEARCH&#8217;)<\/em><\/p>\n\n\n\n<p>is rendering to:<\/p>\n\n\n\n<p><em>&lt;input type=&#8221;submit&#8221; name=&#8221;search&#8221; value=&#8221;SEARCH&#8221; class=&#8221;submit submitButton&#8221; id=&#8221;submit-id-search&#8221; \/&gt;<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Hidden:<\/strong>&nbsp;was creating a hidden input:<\/li><\/ul>\n\n\n\n<p><em>Hidden(&#8216;name&#8217;, &#8216;value&#8217;)<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Button:<\/strong>&nbsp;for creating a button:<\/li><\/ul>\n\n\n\n<p><em>Button(&#8216;name&#8217;, &#8216;value&#8217;)<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Reset:<\/strong>&nbsp;was used to create a reset input:<\/li><\/ul>\n\n\n\n<p><em>reset = Reset(&#8216;name&#8217;, &#8216;value&#8217;)<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Fieldset:<\/strong>&nbsp;It wraps fields in a&nbsp;<em>&lt;fieldset&gt;<\/em>. The first attribute is the command line for the fieldset legend. As indicated earlier, it acts as a Django template:<\/li><\/ul>\n\n\n\n<p><em>Fieldset(&#8220;Text for the legend {{ username }}&#8221;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&#8216;form_field_1&#8217;,<\/em><\/p>\n\n\n\n<p><em>&nbsp;&nbsp;&#8216;form_field_2&#8217;<\/em><\/p>\n\n\n\n<p><em>)<\/em><\/p>\n\n\n\n<p>We\u2019ve just scratched the surface of django-crispy-forms capacities. Of course, more things can be done with their help. For example, django views can switch on &#8220;helper.&#8221; It can also be overwritten.<\/p>\n\n\n\n<p>Django is also helpful if you want to submit class for button creation: &lt;button type=&#8221;submit&#8221; class=&#8221;btn btn-primary&#8221;&gt;Sign in&lt;\/button&gt;. Moreover, developers can create their own templates for specific fields within a form.\\<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Final thoughts<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/ULhvqJLq8Qh3d7xR2GuqgMY0FWwLjShC-1024x723.jpg\" alt=\"\" class=\"wp-image-731\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/ULhvqJLq8Qh3d7xR2GuqgMY0FWwLjShC-1024x723.jpg 1024w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/ULhvqJLq8Qh3d7xR2GuqgMY0FWwLjShC-150x106.jpg 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/ULhvqJLq8Qh3d7xR2GuqgMY0FWwLjShC-300x212.jpg 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/04\/ULhvqJLq8Qh3d7xR2GuqgMY0FWwLjShC-768x542.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you\u2019re curious to delve deeper into the complexities of django crispy, feel free to digest its&nbsp;<a href=\"http:\/\/django-crispy-forms.readthedocs.io\/en\/latest\/\" target=\"_blank\" rel=\"noreferrer noopener\">official documentation<\/a>. Additionally, you can watch this&nbsp;<a href=\"https:\/\/www.youtube.com\/watch?v=r-V3UJ6D67E\" target=\"_blank\" rel=\"noreferrer noopener\">video<\/a>&nbsp;for a better grasp of this topic.&nbsp;<\/p>\n\n\n\n<p> We are\u00a0<a href=\"https:\/\/alternative-spaces.com\/\">here<\/a>\u00a0to make sure that Django plays nice for you! Let your HTML forms look extravagantly beautiful. <\/p>\n\n\n\n<p>Content created by our partner, Onix-systems. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>What first comes to your mind when you hear the word \u201cDjango?\u201d Some people can&#8217;t help but think about the movie: Django Unchained, some about weird jingos. Well, it\u2019s neither jingo patriotism nor a movie \u2014 it\u2019s something that helps developers bring some style to their HTML forms without much effort or time. Let\u2019s learn [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":733,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-728","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts\/728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/comments?post=728"}],"version-history":[{"count":4,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts\/728\/revisions"}],"predecessor-version":[{"id":2588,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts\/728\/revisions\/2588"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/media\/733"}],"wp:attachment":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/media?parent=728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/categories?post=728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/tags?post=728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}