From a872e7b4e9704a4725d66e1d9e89e09ba853af25 Mon Sep 17 00:00:00 2001 From: Michaelyin Date: Sun, 15 Sep 2024 12:03:16 +0800 Subject: [PATCH] chore --- docs/source/formify_helper.md | 2 ++ docs/source/tags.md | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docs/source/formify_helper.md b/docs/source/formify_helper.md index 8413506..6af7f83 100644 --- a/docs/source/formify_helper.md +++ b/docs/source/formify_helper.md @@ -5,6 +5,7 @@ Unlike other form rendering packages, below template tags ```bash +{% form_tag %} {% render_form %} {% render_submit %} {% render_field %} @@ -34,6 +35,7 @@ FORMIFY = { Leveraging Python OOP, you can override some methods of the formify helper to customize the rendering behavior. ```bash +{% form_tag %} -> formify_helper.render_form_tag {% render_form %} -> formify_helper.render_form {% render_submit %} -> formify_helper.render_submit {% render_field %} -> formify_helper.render_field diff --git a/docs/source/tags.md b/docs/source/tags.md index 6d7d6a3..13eeebc 100644 --- a/docs/source/tags.md +++ b/docs/source/tags.md @@ -1,8 +1,28 @@ # Template Tags +A typical case of using formify in a template is like this: + +```html +{% load formify %} + +{% form_tag form action=url %} + + {% csrf_token %} + + {% render_form form %} + + {% render_submit text='Submit' css_class="btn btn-primary" %} + +{% endform_tag %} +``` + +## form_tag + +This tag is to render the form tag, it can help add some attributes to the form tag from the parameters from the template tag. + ## render_form -This tag can render form or formset. +This tag can render `form` or `formset`. It will iterate and render all form fields automatically.