Skip to content

Commit 2516cb4

Browse files
authored
update readme (#4)
1 parent 4e2be20 commit 2516cb4

File tree

4 files changed

+55
-13
lines changed

4 files changed

+55
-13
lines changed

.github/assets/code.png

75.1 KB
Loading

README.md

+7-13
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,19 @@
1111

1212
</div>
1313

14-
```html
15-
{% load formify %}
16-
17-
<form method="post">
18-
19-
{% csrf_token %}
20-
21-
{% render_form form %}
22-
23-
{% render_submit text='Hello Formify!' variant="primary" %}
24-
25-
</form>
26-
```
14+
![Django Formify Code](.github/assets/code.png)
2715

2816
![Django Formify Demo](.github/assets/formify-demo.jpg)
2917

3018
## Documentation
3119

20+
[Documentation](https://django-formify.readthedocs.io/)
21+
3222
## FAQ
3323

3424
### Django-Formify vs Crispy-Tailwind
3525

26+
1. Django-Formify is a fork of Crispy-Tailwind, the core logic is the same.
27+
2. Django-Formify changed the way of rendering, to make it more flexible and easy to customize.
28+
3. Django-Formify has components built using Django-ViewComponent, which makes the code more reusable and easy to maintain. Developers can also create their own components to fit their needs.
29+
4. Django-Formify updated styles of some widgets such as file input to make them look better with Tailwind CSS.

docs/source/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Topics
1111

1212
install.md
1313
get_started.md
14+
tags.md
1415
formify_helper.md
1516
layout.md
1617
component_design.md

docs/source/tags.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Template Tags
2+
3+
## render_form
4+
5+
This tag can render form or formset.
6+
7+
It will iterate and render all form fields automatically.
8+
9+
## render_submit
10+
11+
This tag is to render the submit button.
12+
13+
You can also add extra variables
14+
15+
```html
16+
{% render_submit text='Sign In' css_class="custom-css" name='action_primary' value='action_primary' %}
17+
```
18+
19+
`render_submit` behavior can be customized by overriding `formify_helper.render_submit` method
20+
21+
Please check [Formify Helper](./formify_helper.md) to learn more.
22+
23+
To use formify_helper attached to the `form` instance, you can pass `form` to the `render_submit` like this:
24+
25+
```html
26+
{% render_submit form text='Hello' css_class="btn btn-primary" %}
27+
```
28+
29+
If you have svg in submit button as indicator, you can use this approach to make your code DRY.
30+
31+
## render_field
32+
33+
In some cases, if you want to render a specific field, you can use this tag.
34+
35+
```html
36+
{% render_field form.email %}
37+
```
38+
39+
You can also override formify_helper variable like this:
40+
41+
```html
42+
{% render_field form.email form_show_labels=False %}
43+
```
44+
45+
## render_form_errors
46+
47+
This tag can render form non-field errors.

0 commit comments

Comments
 (0)