From ede1cb6fcac116d36a926da8d6981412aa92c860 Mon Sep 17 00:00:00 2001 From: Art Lukyanchyk <artiom.lukyanchyk@hs-hannover.de> Date: Mon, 15 Jan 2018 19:44:42 +0100 Subject: [PATCH] Update README with info about template tags --- README.md | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5a12c76b..9f5317a7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The current version of this package ships the following own stuff and awesome th ### Own stuff - CD Content like Images under `static/hshassets/img/hsh_brand` -- [Bulma styled forms](https://lab.it.hs-hannover.de/django/hshassets/wikis/bulma-styled-forms), feels like CrispyForms +- Form renderer (like CrispyForms) ### Third party libraries @@ -140,3 +140,30 @@ To help you with the development, there are two command available: does the exact same as the command before, but doesn't stop at the end. It will continuously watch for changes on `*.js`, `*.sass`, `*.scss`, `*.css` files and everything at `img/` and `fonts/` to re-compile -minify and -copy the changed files + +## Forms +Example: +```python +class UnlockForm(forms.Form): + username = forms.CharField( + max_length=400, + widget=forms.TextInput(attrs={"placeholder": _("username"), "icon": "fa-user"}), + label="", # empty, not None + ) +``` +```jinja2 +{% load bulma %} +{% trans "Send" as submit_text %} +{% bulma_form form submit_text=submit_text %} +``` +To change styles and icons of the submit button: `bulma_form` with something like +```jinja2 +{% bulma_form form submit_icon="fa-hand-spock-o" submit_class="button is-danger" %} +``` +Or you can use these template tags for a DIY form: +```jinja2 +{% load bulma %} +{% bulma_form_errors form %} +{% bulma_form_fields form %} +{% bulma_submit_button %} +``` -- GitLab