Skip to content

Commit

Permalink
Update README.rst
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksihakli authored Aug 27, 2024
1 parent d7fed6d commit 84db553
Showing 1 changed file with 8 additions and 24 deletions.
32 changes: 8 additions & 24 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ You can be creative with these variables: e.g. a context processor could
set a default CSS error class on all fields rendered by
``{% render_field %}``.


attr
----
Adds or replaces any single html attribute for the form field.
Expand All @@ -127,7 +126,6 @@ Examples:
<!-- attributes with double colon Vuejs output: v-bind:class="{active:ValueEnabled}" -->
{{ form.search_query|attr:"v-bind::class:{active:ValueEnabled}" }}


add_class
---------

Expand Down Expand Up @@ -176,7 +174,6 @@ Example:
'add_class' filter is just a shortcut for 'append_attr' filter that
adds values to the 'class' attribute.


remove_attr
-----------
Removes any single html attribute for the form field.
Expand All @@ -190,7 +187,6 @@ Example:
<!-- removes autofocus attribute from field element -->
{{ form.title|remove_attr:"autofocus" }}


add_label_class
---------------

Expand All @@ -205,7 +201,6 @@ Example:
<!-- add 2 extra css classes to field label element -->
{{ form.title|add_label_class:"label_class_1 label_class_2" }}


add_error_class
---------------

Expand All @@ -221,7 +216,6 @@ Example:
<!-- add 'error-border' css class on field error -->
{{ form.title|add_error_class:"error-border" }}


add_error_attr
--------------

Expand Down Expand Up @@ -250,7 +244,6 @@ Example:
<!-- add 'is-required' css class on field required -->
{{ form.title|add_required_class:"is-required" }}


field_type and widget_type
--------------------------

Expand All @@ -275,7 +268,6 @@ Output:
<input id="id_name" type="text" name="name" maxlength="100" />
</div>


Mixing render_field and filters
===============================

Expand All @@ -294,7 +286,6 @@ returns:

<input name="category" placeholder="Profession" readonly="readonly" type="text">


Filter chaining
===============

Expand Down Expand Up @@ -337,17 +328,17 @@ With 'rightmost filter wins' rule it wouldn't be possible to override
``|attr:"foo:default_foo"`` in main template.

Rendering form error messages
===============================
=============================

This app can render the following form error messages:

1. Field related errors
2. Non-Field related errors
3. All form errors - Displays all field and non-field related errors. If related to a specific field the name is dispayed above the error, if the error is a general form error, displays __all__

2. Non-field related errors
3. All form errors - Displays all field and Non-field related errors. If related to a specific field the name is dispayed above the error, if the error is a general form error, displays __all__

Field related errors
--------------------

To render field related errors in your form:

Example:
Expand All @@ -359,8 +350,6 @@ Example:
<span class="text-danger">{{ error }}</span>
{% endfor %}



Example usage:

.. code-block:: html+django
Expand All @@ -373,10 +362,9 @@ Example usage:
{% endfor %}
{% endfor %}

Non-field related errors
------------------------


Non-Field related errors
--------------------
Render general form errors:

Example:
Expand All @@ -388,7 +376,6 @@ Example:
<span class="text-danger"> {{ form.non_field_errors }}</span>
{% endif %}


Example usage:

.. code-block:: html+django
Expand All @@ -401,10 +388,9 @@ Example usage:
{% endfor %}
{% endfor %}



All form errors
--------------------
---------------

Render all form errors:

Example:
Expand All @@ -414,8 +400,6 @@ Example:
{% load widget_tweaks %}
{{ form.errors }}



Contributing
============

Expand Down

0 comments on commit 84db553

Please sign in to comment.