crispy-daisyui 0.9.0__tar.gz → 0.9.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/PKG-INFO +2 -3
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/crispy_daisyui.egg-info/PKG-INFO +2 -3
- crispy_daisyui-0.9.1/crispy_daisyui.egg-info/SOURCES.txt +11 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/pyproject.toml +6 -10
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/display_form.html +0 -9
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/errors.html +0 -14
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/errors_formset.html +0 -14
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/field.html +0 -47
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/inputs.html +0 -13
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/alert.html +0 -8
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/baseinput.html +0 -9
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/button.html +0 -1
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/checkbox.html +0 -13
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/checkboxselectmultiple.html +0 -20
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/column.html +0 -4
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/div.html +0 -4
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/field_errors.html +0 -5
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/field_errors_block.html +0 -5
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/field_with_buttons.html +0 -15
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/fieldset.html +0 -6
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/formactions.html +0 -9
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/help_text.html +0 -7
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/help_text_and_errors.html +0 -13
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/inline_field.html +0 -21
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/prepended_appended_text.html +0 -49
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/radioselect.html +0 -14
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/radioselect_inline.html +0 -15
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/row.html +0 -3
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/select.html +0 -13
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/select_option.html +0 -14
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/layout/toggle.html +0 -10
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/table_inline_formset.html +0 -55
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/uni_form.html +0 -11
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/uni_formset.html +0 -8
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/whole_uni_form.html +0 -14
- crispy_daisyui-0.9.0/crispy_daisyui/templates/daisyui/whole_uni_formset.html +0 -30
- crispy_daisyui-0.9.0/crispy_daisyui/templatetags/__init__.py +0 -0
- crispy_daisyui-0.9.0/crispy_daisyui/templatetags/daisyui_field.py +0 -232
- crispy_daisyui-0.9.0/crispy_daisyui/templatetags/daisyui_filters.py +0 -129
- crispy_daisyui-0.9.0/crispy_daisyui.egg-info/SOURCES.txt +0 -46
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/LICENSE +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/README.md +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/crispy_daisyui/__init__.py +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/crispy_daisyui/daisyui.py +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/crispy_daisyui/layout.py +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/crispy_daisyui.egg-info/dependency_links.txt +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/crispy_daisyui.egg-info/requires.txt +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/crispy_daisyui.egg-info/top_level.txt +0 -0
- {crispy_daisyui-0.9.0 → crispy_daisyui-0.9.1}/setup.cfg +0 -0
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crispy-daisyui
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: A DaisyUI package for Django Crispy Forms
|
|
5
5
|
Author: Fabian Geiger
|
|
6
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/fabge/crispy-daisyui
|
|
8
8
|
Project-URL: Changelog, https://github.com/fabge/crispy-daisyui/releases
|
|
9
9
|
Project-URL: Issues, https://github.com/fabge/crispy-daisyui/issues
|
|
10
10
|
Project-URL: CI, https://github.com/fabge/crispy-daisyui/actions
|
|
11
11
|
Keywords: forms,django,crispy,tailwind,daisyui
|
|
12
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
12
|
Requires-Python: >=3.7
|
|
14
13
|
Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crispy-daisyui
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.1
|
|
4
4
|
Summary: A DaisyUI package for Django Crispy Forms
|
|
5
5
|
Author: Fabian Geiger
|
|
6
|
-
License: Apache-2.0
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://github.com/fabge/crispy-daisyui
|
|
8
8
|
Project-URL: Changelog, https://github.com/fabge/crispy-daisyui/releases
|
|
9
9
|
Project-URL: Issues, https://github.com/fabge/crispy-daisyui/issues
|
|
10
10
|
Project-URL: CI, https://github.com/fabge/crispy-daisyui/actions
|
|
11
11
|
Keywords: forms,django,crispy,tailwind,daisyui
|
|
12
|
-
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
12
|
Requires-Python: >=3.7
|
|
14
13
|
Description-Content-Type: text/markdown
|
|
15
14
|
License-File: LICENSE
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
crispy_daisyui/__init__.py
|
|
5
|
+
crispy_daisyui/daisyui.py
|
|
6
|
+
crispy_daisyui/layout.py
|
|
7
|
+
crispy_daisyui.egg-info/PKG-INFO
|
|
8
|
+
crispy_daisyui.egg-info/SOURCES.txt
|
|
9
|
+
crispy_daisyui.egg-info/dependency_links.txt
|
|
10
|
+
crispy_daisyui.egg-info/requires.txt
|
|
11
|
+
crispy_daisyui.egg-info/top_level.txt
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "crispy-daisyui"
|
|
3
|
-
version = "0.9.
|
|
3
|
+
version = "0.9.1"
|
|
4
4
|
description = "A DaisyUI package for Django Crispy Forms"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{name = "Fabian Geiger"}]
|
|
7
|
-
license =
|
|
8
|
-
classifiers = [
|
|
9
|
-
"License :: OSI Approved :: Apache Software License"
|
|
10
|
-
]
|
|
7
|
+
license = "Apache-2.0"
|
|
11
8
|
keywords = ["forms", "django", "crispy", "tailwind", "daisyui"]
|
|
12
9
|
requires-python = ">=3.7"
|
|
13
10
|
dependencies = [
|
|
@@ -21,9 +18,8 @@ Changelog = "https://github.com/fabge/crispy-daisyui/releases"
|
|
|
21
18
|
Issues = "https://github.com/fabge/crispy-daisyui/issues"
|
|
22
19
|
CI = "https://github.com/fabge/crispy-daisyui/actions"
|
|
23
20
|
|
|
24
|
-
[tool.setuptools]
|
|
25
|
-
|
|
26
|
-
include-package-data = true
|
|
21
|
+
[tool.setuptools.packages.find]
|
|
22
|
+
include = ["crispy_daisyui"]
|
|
27
23
|
|
|
28
|
-
[tool.
|
|
29
|
-
|
|
24
|
+
[tool.uv]
|
|
25
|
+
package = true
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{% if form.non_field_errors %}
|
|
2
|
-
<div class="alert mb-4">
|
|
3
|
-
{% if form_error_title %}
|
|
4
|
-
<div class="bg-red-500 text-white font-bold rounded-t px-4 py-2">
|
|
5
|
-
{{ form_error_title }}
|
|
6
|
-
</div>
|
|
7
|
-
{% endif %}
|
|
8
|
-
<div class="border border-red-400 rounded-b bg-red-100 px-4 py-3 text-red-700">
|
|
9
|
-
<ul>
|
|
10
|
-
{{ form.non_field_errors|unordered_list }}
|
|
11
|
-
</ul>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
{% endif %}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{% if formset.non_form_errors %}
|
|
2
|
-
<div class="alert alert-error mb-4">
|
|
3
|
-
{% if formset_error_title %}
|
|
4
|
-
<div class="font-bold rounded-t">
|
|
5
|
-
{{ formset_error_title }}
|
|
6
|
-
</div>
|
|
7
|
-
{% endif %}
|
|
8
|
-
<div>
|
|
9
|
-
<ul>
|
|
10
|
-
{{ formset.non_form_errors|unordered_list }}
|
|
11
|
-
</ul>
|
|
12
|
-
</div>
|
|
13
|
-
</div>
|
|
14
|
-
{% endif %}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{% load daisyui_field %}
|
|
2
|
-
|
|
3
|
-
{% if field.is_hidden %}
|
|
4
|
-
{{ field }}
|
|
5
|
-
{% else %}
|
|
6
|
-
{# Opening Div and Label first #}
|
|
7
|
-
|
|
8
|
-
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="{% if wrapper_class %}{{ wrapper_class }} {% endif %}{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}">
|
|
9
|
-
{% if field.label and form_show_labels and not field|is_toggle and not field|is_checkbox %}
|
|
10
|
-
<label for="{{ field.id_for_label }}" class="{% if label_class %}{{ label_class }}{% endif %}">
|
|
11
|
-
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
|
12
|
-
</label>
|
|
13
|
-
{% endif %}
|
|
14
|
-
|
|
15
|
-
{# if field has a special template then use this #}
|
|
16
|
-
{% if field|is_select %}
|
|
17
|
-
<div class="{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
|
|
18
|
-
{% include 'daisyui/layout/select.html' %}
|
|
19
|
-
</div>
|
|
20
|
-
{% elif field|is_checkboxselectmultiple %}
|
|
21
|
-
<div class="{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
|
|
22
|
-
{% include 'daisyui/layout/checkboxselectmultiple.html' %}
|
|
23
|
-
</div>
|
|
24
|
-
{% elif field|is_toggle %}
|
|
25
|
-
<div class="{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
|
|
26
|
-
{% include 'daisyui/layout/toggle.html' %}
|
|
27
|
-
</div>
|
|
28
|
-
{% elif field|is_checkbox %}
|
|
29
|
-
<div class="{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
|
|
30
|
-
{% include 'daisyui/layout/checkbox.html' %}
|
|
31
|
-
</div>
|
|
32
|
-
{% elif field|is_radioselect %}
|
|
33
|
-
<div class="{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}"{% if flat_attrs %} {{ flat_attrs|safe }}{% endif %}>
|
|
34
|
-
{% include 'daisyui/layout/radioselect.html' %}
|
|
35
|
-
</div>
|
|
36
|
-
{% else %}
|
|
37
|
-
|
|
38
|
-
{# otherwise use django rendering with additional classes added #}
|
|
39
|
-
{% daisyui_field field %}
|
|
40
|
-
{% endif %}
|
|
41
|
-
|
|
42
|
-
{% include 'daisyui/layout/help_text_and_errors.html' %}
|
|
43
|
-
|
|
44
|
-
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
{% endif %}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{% if inputs %}
|
|
2
|
-
<div class="form-group{% if 'form-horizontal' in form_class %} row{% endif %}">
|
|
3
|
-
{% if label_class %}
|
|
4
|
-
<div class="aab {{ label_class }}"></div>
|
|
5
|
-
{% endif %}
|
|
6
|
-
|
|
7
|
-
<div class="{{ field_class }}">
|
|
8
|
-
{% for input in inputs %}
|
|
9
|
-
{% include "daisyui/layout/baseinput.html" %}
|
|
10
|
-
{% endfor %}
|
|
11
|
-
</div>
|
|
12
|
-
</div>
|
|
13
|
-
{% endif %}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<div{% if alert.css_id %} id="{{ alert.css_id }}"{% endif %} class="{{ alert.css_class|default:'bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative' }}" role="alert">
|
|
2
|
-
<div class="block sm:inline">{{ content|safe }}</div>
|
|
3
|
-
{% if dismiss %}
|
|
4
|
-
<span class="absolute top-0 bottom-0 right-0 px-4 py-3">
|
|
5
|
-
<svg class="fill-current h-6 w-6 text-red-500" role="button" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><title>Close</title><path d="M14.348 14.849a1.2 1.2 0 0 1-1.697 0L10 11.819l-2.651 3.029a1.2 1.2 0 1 1-1.697-1.697l2.758-3.15-2.759-3.152a1.2 1.2 0 1 1 1.697-1.697L10 8.183l2.651-3.031a1.2 1.2 0 1 1 1.697 1.697l-2.758 3.152 2.758 3.15a1.2 1.2 0 0 1 0 1.698z"/></svg>
|
|
6
|
-
</span>
|
|
7
|
-
{% endif %}
|
|
8
|
-
</div>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<input type="{{ input.input_type }}"
|
|
2
|
-
name="{% if input.name|wordcount > 1 %}{{ input.name|slugify }}{% else %}{{ input.name }}{% endif %}"
|
|
3
|
-
value="{{ input.value }}"
|
|
4
|
-
{% if input.input_type != "hidden" %}
|
|
5
|
-
class="{{ input.field_classes }}"
|
|
6
|
-
id="{% if input.id %}{{ input.id }}{% else %}{{ input.input_type }}-id-{{ input.name|slugify }}{% endif %}"
|
|
7
|
-
{% endif %}
|
|
8
|
-
{{ input.flat_attrs|safe }}
|
|
9
|
-
/>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<button {{ button.flat_attrs|safe }} class="btn">{{ button.content|safe }}</button>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_filters %}
|
|
2
|
-
|
|
3
|
-
<div class="form-control">
|
|
4
|
-
<label class="label cursor-pointer">
|
|
5
|
-
<span class="label-text">{{ field.label }}</span>
|
|
6
|
-
<input type="checkbox"
|
|
7
|
-
class="checkbox {{ field.css_classes }}"
|
|
8
|
-
name="{{ field.html_name }}"
|
|
9
|
-
id="{{ field.auto_id }}"
|
|
10
|
-
{% if field.value %}checked="checked"{% endif %}
|
|
11
|
-
{{ field.field.widget.attrs|flatatt }}>
|
|
12
|
-
</label>
|
|
13
|
-
</div>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_filters %}
|
|
2
|
-
{% load l10n %}
|
|
3
|
-
|
|
4
|
-
{% for choice in field.field.choices %}
|
|
5
|
-
<div class="form-control">
|
|
6
|
-
<label class="label cursor-pointer">
|
|
7
|
-
<input type="checkbox" class="checkbox"
|
|
8
|
-
{% if choice.0 in field.value or choice.0|stringformat:"s" in field.value or choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %}
|
|
9
|
-
name="{{ field.html_name }}"
|
|
10
|
-
id="id_{{ field.html_name }}_{{ forloop.counter }}"
|
|
11
|
-
value="{{ choice.0|unlocalize }}"
|
|
12
|
-
{{ field.field.widget.attrs|flatatt }}>
|
|
13
|
-
<span class="label-text">{{ choice.1|unlocalize }}</span>
|
|
14
|
-
</label>
|
|
15
|
-
</div>
|
|
16
|
-
{% endfor %}
|
|
17
|
-
|
|
18
|
-
{% if field.errors and not inline_class %}
|
|
19
|
-
{% include 'daisyui/layout/field_errors_block.html' %}
|
|
20
|
-
{% endif %}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{% load daisyui_field %}
|
|
2
|
-
|
|
3
|
-
<div{% if div.css_id %} id="{{ div.css_id }}"{% endif %} class="{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}{% if div.css_class %} {{ div.css_class }}{% endif %}" {{ div.flat_attrs|safe }}>
|
|
4
|
-
{% if field.label and form_show_labels %}
|
|
5
|
-
<label for="{{ field.id_for_label }}" class="{% if 'form-horizontal' in form_class %}col-form-label {% endif %}{{ label_class }}{% if field.field.required %} requiredField{% endif %}">
|
|
6
|
-
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
|
7
|
-
</label>
|
|
8
|
-
{% endif %}
|
|
9
|
-
|
|
10
|
-
<div class="flex{% if field_class %} {{ field_class }}{% endif %}">
|
|
11
|
-
{% daisyui_field field "class" "border border-gray-300 rounded-lg rounded-r-none px-4 py-2 w-full focus:outline-none text-gray-700 border-r-0 leading-normal" %}
|
|
12
|
-
<span class="{% if field.errors %}border-red-500 border-r-0 {% else %}border-gray-300 {% endif %}border rounded-lg rounded-l-none bg-gray-200 text-gray-800 flex items-center">{{ buttons|safe }}</span>
|
|
13
|
-
{% include 'daisyui/layout/help_text_and_errors.html' %}
|
|
14
|
-
</div>
|
|
15
|
-
</div>
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
<fieldset {% if fieldset.css_id %}id="{{ fieldset.css_id }}"{% endif %}
|
|
2
|
-
{% if fieldset.css_class or form_style %}class="{{ fieldset.css_class }} {{ form_style }}"{% endif %}
|
|
3
|
-
{{ fieldset.flat_attrs|safe }}>
|
|
4
|
-
{% if legend %}<legend>{{ legend|safe }}</legend>{% endif %}
|
|
5
|
-
{{ fields|safe }}
|
|
6
|
-
</fieldset>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
<div{% if formactions.attrs %} {{ formactions.flat_attrs|safe }}{% endif %} class="form-group{% if 'form-horizontal' in form_class %} row{% endif %}">
|
|
2
|
-
{% if label_class %}
|
|
3
|
-
<div class="aab {{ label_class }}"></div>
|
|
4
|
-
{% endif %}
|
|
5
|
-
|
|
6
|
-
<div class="{{ field_class }}">
|
|
7
|
-
{{ fields_output|safe }}
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{% if field.help_text %}
|
|
2
|
-
{% if help_text_inline %}
|
|
3
|
-
<p id="hint_{{ field.auto_id }}" class="text-gray-600">{{ field.help_text|safe }}</p>x
|
|
4
|
-
{% else %}
|
|
5
|
-
<small id="hint_{{ field.auto_id }}" class="text-gray-600">{{ field.help_text|safe }}</small>
|
|
6
|
-
{% endif %}
|
|
7
|
-
{% endif %}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{% if help_text_inline and not error_text_inline %}
|
|
2
|
-
{% include 'daisyui/layout/help_text.html' %}
|
|
3
|
-
{% endif %}
|
|
4
|
-
|
|
5
|
-
{% if error_text_inline %}
|
|
6
|
-
{% include 'daisyui/layout/field_errors.html' %}
|
|
7
|
-
{% else %}
|
|
8
|
-
{% include 'daisyui/layout/field_errors_block.html' %}
|
|
9
|
-
{% endif %}
|
|
10
|
-
|
|
11
|
-
{% if not help_text_inline %}
|
|
12
|
-
{% include 'daisyui/layout/help_text.html' %}
|
|
13
|
-
{% endif %}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{% load daisyui_field %}
|
|
2
|
-
|
|
3
|
-
{% if field.is_hidden %}
|
|
4
|
-
{{ field }}
|
|
5
|
-
{% else %}
|
|
6
|
-
{% if field|is_checkbox %}
|
|
7
|
-
<div id="div_{{ field.auto_id }}" class="{% if wrapper_class %} {{ wrapper_class }}{% endif %}">
|
|
8
|
-
<label for="{{ field.id_for_label }}" class="{% if field.field.required %} requiredField{% endif %}">
|
|
9
|
-
{% daisyui_field field %}
|
|
10
|
-
{{ field.label|safe }}
|
|
11
|
-
</label>
|
|
12
|
-
</div>
|
|
13
|
-
{% else %}
|
|
14
|
-
<div id="div_{{ field.auto_id }}" class="{% if wrapper_class %} {{ wrapper_class }}{% endif %}">
|
|
15
|
-
<label for="{{ field.id_for_label }}" class="sr-only{% if field.field.required %} requiredField{% endif %}">
|
|
16
|
-
{{ field.label|safe }}
|
|
17
|
-
</label>
|
|
18
|
-
{% daisyui_field field 'placeholder' field.label %}
|
|
19
|
-
</div>
|
|
20
|
-
{% endif %}
|
|
21
|
-
{% endif %}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
{% load daisyui_field %}
|
|
2
|
-
|
|
3
|
-
{% if field.is_hidden %}
|
|
4
|
-
{{ field }}
|
|
5
|
-
{% else %}
|
|
6
|
-
<div id="div_{{ field.auto_id }}" class="{% if wrapper_class %}{{ wrapper_class }} {% endif %}{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}">
|
|
7
|
-
|
|
8
|
-
{% if field.label and form_show_labels %}
|
|
9
|
-
<label for="{{ field.id_for_label }}" class="{% if label_class %}{{ label_class }}{% endif %}">
|
|
10
|
-
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
|
11
|
-
</label>
|
|
12
|
-
{% endif %}
|
|
13
|
-
|
|
14
|
-
<div class="{{ field_class }}">
|
|
15
|
-
<div class="flex">
|
|
16
|
-
|
|
17
|
-
{% if crispy_prepended_text and not crispy_appended_text %}
|
|
18
|
-
<span class="{% if field.errors %}border-red-500 border-r-0 {% else %}border-gray-300 {% endif %}border rounded-lg rounded-r-none px-3 bg-gray-200 text-gray-800 flex items-center">{{ crispy_prepended_text|safe }}</span>
|
|
19
|
-
{% if field.errors %}
|
|
20
|
-
{% daisyui_field field "class" "border border-red-500 rounded-lg rounded-l-none px-4 py-2 w-full focus:outline-none text-gray-700 border-l-0 leading-normal" %}
|
|
21
|
-
{% else %}
|
|
22
|
-
{% daisyui_field field "class" "border border-gray-300 rounded-lg rounded-l-none px-4 py-2 w-full focus:outline-none text-gray-700 border-l-0 leading-normal" %}
|
|
23
|
-
{% endif %}
|
|
24
|
-
|
|
25
|
-
{% elif crispy_appended_text and not crispy_prepended_text %}
|
|
26
|
-
{% if field.errors %}
|
|
27
|
-
{% daisyui_field field "class" "border border-red-500 rounded-lg rounded-r-none px-4 py-2 w-full focus:outline-none text-gray-700 border-r-0 leading-normal" %}
|
|
28
|
-
{% else %}
|
|
29
|
-
{% daisyui_field field "class" "border border-gray-300 rounded-lg rounded-r-none px-4 py-2 w-full focus:outline-none text-gray-700 border-r-0 leading-normal" %}
|
|
30
|
-
{% endif %}
|
|
31
|
-
<span class="{% if field.errors %}border-red-500 border-l-0 {% else %}border-gray-300 {% endif %}border rounded-lg rounded-l-none px-3 bg-gray-200 text-gray-800 flex items-center">{{ crispy_appended_text|safe }}</span>
|
|
32
|
-
|
|
33
|
-
{% else %}
|
|
34
|
-
<span class="{% if field.errors %}border-red-500 border-r-0 {% else %}border-gray-300 {% endif %}border rounded-lg rounded-r-none px-3 bg-gray-200 text-gray-800 flex items-center">{{ crispy_prepended_text|safe }}</span>
|
|
35
|
-
{% if field.errors %}
|
|
36
|
-
{% daisyui_field field "class" "border border-r-0 border-l-0 border-red-500 px-4 py-2 w-full focus:outline-none text-gray-700 border-r-0 leading-normal" %}
|
|
37
|
-
{% else %}
|
|
38
|
-
{% daisyui_field field "class" "border border-gray-300 px-4 py-2 w-full focus:outline-none text-gray-700 border-r-0 leading-normal" %}
|
|
39
|
-
{% endif %}
|
|
40
|
-
<span class="{% if field.errors %}border-red-500 border-l-0 {% else %}border-gray-300 {% endif %}border rounded-lg rounded-l-none px-3 bg-gray-200 text-gray-800 flex items-center">{{ crispy_appended_text|safe }}</span>
|
|
41
|
-
|
|
42
|
-
{% endif %}
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
|
|
46
|
-
{% include 'daisyui/layout/field_errors.html' %}
|
|
47
|
-
{% include 'daisyui/layout/help_text.html' %}
|
|
48
|
-
</div>
|
|
49
|
-
{% endif %}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_filters %}
|
|
2
|
-
{% load l10n %}
|
|
3
|
-
|
|
4
|
-
{% for choice in field.field.choices %}
|
|
5
|
-
<div class="form-control">
|
|
6
|
-
<label for="id_{{ field.html_name }}_{{ forloop.counter }}" class="label cursor-pointer">
|
|
7
|
-
<input type="radio" class="radio"{% if choice.0|stringformat:"s" == field.value|default_if_none:""|stringformat:"s" %} checked="checked"{% endif %} name="{{ field.html_name }}" id="id_{{ field.html_name }}_{{ forloop.counter }}" value="{{ choice.0|unlocalize }}" {{ field.field.widget.attrs|flatatt }}>
|
|
8
|
-
<span class="label-text">{{ choice.1|unlocalize }}</span>
|
|
9
|
-
</label>
|
|
10
|
-
{% if field.errors and forloop.last %}
|
|
11
|
-
{# include 'daisyui/layout/field_errors_block.html' <-- bs4 template adds this here. Currently this pack adds it in field.html #}
|
|
12
|
-
{% endif %}
|
|
13
|
-
</div>
|
|
14
|
-
{% endfor %}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
{% if field.is_hidden %}
|
|
2
|
-
{{ field }}
|
|
3
|
-
{% else %}
|
|
4
|
-
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="{% if wrapper_class %}{{ wrapper_class }} {% endif %}{% if field_class %}{{ field_class }}{% else %}mb-3{% endif %}">
|
|
5
|
-
|
|
6
|
-
{% if field.label %}
|
|
7
|
-
<label for="{{ field.id_for_label }}" class="{% if label_class %}{{ label_class }} {% endif %}{% if not inline_class %} col-form-label{% endif %}{% if field.field.required %} requiredField{% endif %}">
|
|
8
|
-
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
|
|
9
|
-
</label>
|
|
10
|
-
{% endif %}
|
|
11
|
-
|
|
12
|
-
<div id="div_{{ field.auto_id }}" class="flex flex-row{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
|
|
13
|
-
{% include 'daisyui/layout/radioselect.html' %}
|
|
14
|
-
</div>
|
|
15
|
-
{% endif %}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_filters %}
|
|
2
|
-
{% load l10n %}
|
|
3
|
-
|
|
4
|
-
<select
|
|
5
|
-
class="select select-bordered w-full focus:ring focus:outline-none{% if field.errors %} select-error{% endif %}"
|
|
6
|
-
name="{{ field.html_name }}"
|
|
7
|
-
id="{{ field.id_for_label }}"
|
|
8
|
-
{% if field.field.widget.allow_multiple_selected %}multiple{% endif %}
|
|
9
|
-
{{ field.field.widget.attrs|flatatt }}>
|
|
10
|
-
{% for value, label in field.field.choices %}
|
|
11
|
-
{% include "daisyui/layout/select_option.html" with value=value label=label %}
|
|
12
|
-
{% endfor %}
|
|
13
|
-
</select>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_filters %}
|
|
2
|
-
{% load l10n %}
|
|
3
|
-
|
|
4
|
-
{% with current=field.value multi=field.field.widget.allow_multiple_selected %}
|
|
5
|
-
<option value="{{ value|stringformat:'s' }}"
|
|
6
|
-
{% if current %}
|
|
7
|
-
{% if multi %}
|
|
8
|
-
{% if value|stringformat:'s' in current %}selected{% endif %}
|
|
9
|
-
{% else %}
|
|
10
|
-
{% if current|stringformat:'s' == value|stringformat:'s' %}selected{% endif %}
|
|
11
|
-
{% endif %}
|
|
12
|
-
{% endif %}
|
|
13
|
-
>{{ label }}</option>
|
|
14
|
-
{% endwith %}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_filters %}
|
|
2
|
-
{% load l10n %}
|
|
3
|
-
|
|
4
|
-
<div class="form-control">
|
|
5
|
-
<label class="label cursor-pointer" for="{{ field.id_for_label }}">
|
|
6
|
-
<span class="label-text">{{ field.label }}</span>
|
|
7
|
-
<input type="checkbox" class="toggle" name="{{ field.html_name }}" id="{{ field.id_for_label }}"
|
|
8
|
-
{% if field.value %}checked="checked"{% endif %} {{ field.field.widget.attrs|flatatt }}>
|
|
9
|
-
</label>
|
|
10
|
-
</div>
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_tags %}
|
|
2
|
-
{% load crispy_forms_utils %}
|
|
3
|
-
{% load daisyui_field %}
|
|
4
|
-
|
|
5
|
-
{% specialspaceless %}
|
|
6
|
-
{% if formset_tag %}
|
|
7
|
-
<form {{ flat_attrs|safe }} method="{{ form_method }}" {% if formset.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
|
8
|
-
{% endif %}
|
|
9
|
-
{% if formset_method|lower == 'post' and not disable_csrf %}
|
|
10
|
-
{% csrf_token %}
|
|
11
|
-
{% endif %}
|
|
12
|
-
|
|
13
|
-
<div>
|
|
14
|
-
{{ formset.management_form|crispy }}
|
|
15
|
-
</div>
|
|
16
|
-
|
|
17
|
-
{% include "daisyui/errors_formset.html" %}
|
|
18
|
-
|
|
19
|
-
<table{% if form_id %} id="{{ form_id }}_table"{% endif%} class="table-auto">
|
|
20
|
-
<thead>
|
|
21
|
-
{% if formset.readonly and not formset.queryset.exists %}
|
|
22
|
-
{% else %}
|
|
23
|
-
<tr>
|
|
24
|
-
{% for field in formset.forms.0 %}
|
|
25
|
-
{% if field.label and not field.is_hidden %}
|
|
26
|
-
<th for="{{ field.auto_id }}" class="px-4 py-2">
|
|
27
|
-
{{ field.label|safe }}{% if field.field.required and not field|is_checkbox %}<span class="asteriskField">*</span>{% endif %}
|
|
28
|
-
</th>
|
|
29
|
-
{% endif %}
|
|
30
|
-
{% endfor %}
|
|
31
|
-
</tr>
|
|
32
|
-
{% endif %}
|
|
33
|
-
</thead>
|
|
34
|
-
|
|
35
|
-
<tbody>
|
|
36
|
-
|
|
37
|
-
{% for form in formset %}
|
|
38
|
-
{% if form_show_errors and not form.is_extra %}
|
|
39
|
-
{% include "daisyui/errors.html" %}
|
|
40
|
-
{% endif %}
|
|
41
|
-
|
|
42
|
-
<tr>
|
|
43
|
-
{% for field in form %}
|
|
44
|
-
{% include 'daisyui/field.html' with tag="td" form_show_labels=False field_class="border px-4 py-2" %}
|
|
45
|
-
{% endfor %}
|
|
46
|
-
</tr>
|
|
47
|
-
{% endfor %}
|
|
48
|
-
</tbody>
|
|
49
|
-
</table>
|
|
50
|
-
|
|
51
|
-
<div class="mt-3">
|
|
52
|
-
{% include "daisyui/inputs.html" %}
|
|
53
|
-
</div>
|
|
54
|
-
{% if formset_tag %}</form>{% endif %}
|
|
55
|
-
{% endspecialspaceless %}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_utils %}
|
|
2
|
-
|
|
3
|
-
{% specialspaceless %}
|
|
4
|
-
{% if include_media %}{{ form.media }}{% endif %}
|
|
5
|
-
{% if form_show_errors %}
|
|
6
|
-
{% include "daisyui/errors.html" %}
|
|
7
|
-
{% endif %}
|
|
8
|
-
{% for field in form %}
|
|
9
|
-
{% include field_template %}
|
|
10
|
-
{% endfor %}
|
|
11
|
-
{% endspecialspaceless %}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_utils %}
|
|
2
|
-
|
|
3
|
-
{% specialspaceless %}
|
|
4
|
-
{% if form_tag %}<form {{ flat_attrs|safe }} method="{{ form_method }}" {% if form.is_multipart %} enctype="multipart/form-data"{% endif %}>{% endif %}
|
|
5
|
-
{% if form_method|lower == 'post' and not disable_csrf %}
|
|
6
|
-
{% csrf_token %}
|
|
7
|
-
{% endif %}
|
|
8
|
-
|
|
9
|
-
{% include "daisyui/display_form.html" %}
|
|
10
|
-
|
|
11
|
-
{% include "daisyui/inputs.html" %}
|
|
12
|
-
|
|
13
|
-
{% if form_tag %}</form>{% endif %}
|
|
14
|
-
{% endspecialspaceless %}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{% load crispy_forms_tags %}
|
|
2
|
-
{% load crispy_forms_utils %}
|
|
3
|
-
|
|
4
|
-
{% specialspaceless %}
|
|
5
|
-
{% if formset_tag %}
|
|
6
|
-
<form {{ flat_attrs|safe }} method="{{ form_method }}" {% if formset.is_multipart %} enctype="multipart/form-data"{% endif %}>
|
|
7
|
-
{% endif %}
|
|
8
|
-
{% if formset_method|lower == 'post' and not disable_csrf %}
|
|
9
|
-
{% csrf_token %}
|
|
10
|
-
{% endif %}
|
|
11
|
-
|
|
12
|
-
<div>
|
|
13
|
-
{{ formset.management_form|crispy }}
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
{% include "daisyui/errors_formset.html" %}
|
|
17
|
-
|
|
18
|
-
{% for form in formset %}
|
|
19
|
-
{% include "daisyui/display_form.html" %}
|
|
20
|
-
{% endfor %}
|
|
21
|
-
|
|
22
|
-
{% if inputs %}
|
|
23
|
-
<div class="form-actions">
|
|
24
|
-
{% for input in inputs %}
|
|
25
|
-
{% include "daisyui/layout/baseinput.html" %}
|
|
26
|
-
{% endfor %}
|
|
27
|
-
</div>
|
|
28
|
-
{% endif %}
|
|
29
|
-
{% if formset_tag %}</form>{% endif %}
|
|
30
|
-
{% endspecialspaceless %}
|
|
File without changes
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
# This file is currently copied directly from django-crispy-forms
|
|
2
|
-
# Changes to core form are highlighted. These are to add additional input classes
|
|
3
|
-
# to meet requirements of Tailwind
|
|
4
|
-
|
|
5
|
-
import re
|
|
6
|
-
|
|
7
|
-
from django import forms, template
|
|
8
|
-
from django.conf import settings
|
|
9
|
-
from django.template import Context, loader
|
|
10
|
-
|
|
11
|
-
from crispy_forms.utils import TEMPLATE_PACK, get_template_pack
|
|
12
|
-
from crispy_daisyui.daisyui import CSSContainer
|
|
13
|
-
|
|
14
|
-
register = template.Library()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@register.filter
|
|
18
|
-
def is_checkbox(field):
|
|
19
|
-
return isinstance(field.field.widget, forms.CheckboxInput)
|
|
20
|
-
|
|
21
|
-
@register.filter
|
|
22
|
-
def is_toggle(field):
|
|
23
|
-
return isinstance(field.field.widget, forms.CheckboxInput) and 'toggle' in field.field.widget.attrs.get('class', '')
|
|
24
|
-
|
|
25
|
-
@register.filter
|
|
26
|
-
def is_password(field):
|
|
27
|
-
return isinstance(field.field.widget, forms.PasswordInput)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
@register.filter
|
|
31
|
-
def is_radioselect(field):
|
|
32
|
-
return isinstance(field.field.widget, forms.RadioSelect)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@register.filter
|
|
36
|
-
def is_select(field):
|
|
37
|
-
return isinstance(field.field.widget, forms.Select)
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
@register.filter
|
|
41
|
-
def is_checkboxselectmultiple(field):
|
|
42
|
-
return isinstance(field.field.widget, forms.CheckboxSelectMultiple)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
@register.filter
|
|
46
|
-
def is_file(field):
|
|
47
|
-
return isinstance(field.field.widget, forms.FileInput)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@register.filter
|
|
51
|
-
def is_clearable_file(field):
|
|
52
|
-
return isinstance(field.field.widget, forms.ClearableFileInput)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
@register.filter
|
|
56
|
-
def is_multivalue(field):
|
|
57
|
-
return isinstance(field.field.widget, forms.MultiWidget)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
@register.filter
|
|
61
|
-
def classes(field):
|
|
62
|
-
"""
|
|
63
|
-
Returns CSS classes of a field
|
|
64
|
-
"""
|
|
65
|
-
return field.widget.attrs.get("class", None)
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
@register.filter
|
|
69
|
-
def css_class(field):
|
|
70
|
-
"""
|
|
71
|
-
Returns widgets class name in lowercase
|
|
72
|
-
"""
|
|
73
|
-
return field.field.widget.__class__.__name__.lower()
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def pairwise(iterable):
|
|
77
|
-
"""s -> (s0,s1), (s2,s3), (s4, s5), ..."""
|
|
78
|
-
a = iter(iterable)
|
|
79
|
-
return zip(a, a)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
class CrispyDaisyUiFieldNode(template.Node):
|
|
83
|
-
|
|
84
|
-
base_input = (
|
|
85
|
-
"input input-bordered w-full focus:ring focus:outline-none"
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
default_styles = {
|
|
89
|
-
"text": base_input,
|
|
90
|
-
"number": base_input,
|
|
91
|
-
"radioselect": "radio",
|
|
92
|
-
"email": base_input,
|
|
93
|
-
"url": base_input,
|
|
94
|
-
"password": base_input,
|
|
95
|
-
"hidden": "",
|
|
96
|
-
"multiplehidden": "",
|
|
97
|
-
"file": "file-input file-input-bordered w-full focus:ring focus:outline-none",
|
|
98
|
-
"clearablefile": "file-input file-input-bordered w-full focus:ring focus:outline-none",
|
|
99
|
-
"textarea": "textarea textarea-bordered w-full focus:ring focus:outline-none",
|
|
100
|
-
"date": base_input,
|
|
101
|
-
"datetime": base_input,
|
|
102
|
-
"time": base_input,
|
|
103
|
-
"checkbox": "checkbox",
|
|
104
|
-
"select": "select select-bordered w-full",
|
|
105
|
-
"nullbooleanselect": "",
|
|
106
|
-
"selectmultiple": "",
|
|
107
|
-
"checkboxselectmultiple": "checkbox",
|
|
108
|
-
"multi": "",
|
|
109
|
-
"splitdatetime": base_input,
|
|
110
|
-
"splithiddendatetime": "",
|
|
111
|
-
"selectdate": "",
|
|
112
|
-
"error_border": "border-red-500",
|
|
113
|
-
"toggle": "toggle",
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
default_container = CSSContainer(default_styles)
|
|
117
|
-
|
|
118
|
-
def __init__(self, field, attrs):
|
|
119
|
-
self.field = field
|
|
120
|
-
self.attrs = attrs
|
|
121
|
-
self.html5_required = "html5_required"
|
|
122
|
-
|
|
123
|
-
def render(self, context): # noqa: C901
|
|
124
|
-
# Nodes are not threadsafe so we must store and look up our instance
|
|
125
|
-
# variables in the current rendering context first
|
|
126
|
-
if self not in context.render_context:
|
|
127
|
-
context.render_context[self] = (
|
|
128
|
-
template.Variable(self.field),
|
|
129
|
-
self.attrs,
|
|
130
|
-
template.Variable(self.html5_required),
|
|
131
|
-
)
|
|
132
|
-
|
|
133
|
-
field, attrs, html5_required = context.render_context[self]
|
|
134
|
-
field = field.resolve(context)
|
|
135
|
-
try:
|
|
136
|
-
html5_required = html5_required.resolve(context)
|
|
137
|
-
except template.VariableDoesNotExist:
|
|
138
|
-
html5_required = False
|
|
139
|
-
|
|
140
|
-
# If template pack has been overridden in FormHelper we can pick it from context
|
|
141
|
-
template_pack = context.get("template_pack", TEMPLATE_PACK)
|
|
142
|
-
|
|
143
|
-
# There are special django widgets that wrap actual widgets,
|
|
144
|
-
# such as forms.widgets.MultiWidget, admin.widgets.RelatedFieldWidgetWrapper
|
|
145
|
-
widgets = getattr(field.field.widget, "widgets", [getattr(field.field.widget, "widget", field.field.widget)])
|
|
146
|
-
|
|
147
|
-
if isinstance(attrs, dict):
|
|
148
|
-
attrs = [attrs] * len(widgets)
|
|
149
|
-
|
|
150
|
-
converters = {}
|
|
151
|
-
converters.update(getattr(settings, "CRISPY_CLASS_CONVERTERS", {}))
|
|
152
|
-
|
|
153
|
-
for widget, attr in zip(widgets, attrs):
|
|
154
|
-
class_name = widget.__class__.__name__.lower()
|
|
155
|
-
class_name = converters.get(class_name, class_name)
|
|
156
|
-
css_class = widget.attrs.get("class", "")
|
|
157
|
-
if css_class:
|
|
158
|
-
if css_class.find(class_name) == -1:
|
|
159
|
-
css_class += " %s" % class_name
|
|
160
|
-
else:
|
|
161
|
-
css_class = class_name
|
|
162
|
-
|
|
163
|
-
# Added additional code for Tailwind if class has not been passed in via the tag in the template
|
|
164
|
-
if template_pack == "daisyui" and '"class"' not in attr.keys():
|
|
165
|
-
css_container = context.get("css_container", self.default_container)
|
|
166
|
-
if css_container:
|
|
167
|
-
css = " " + css_container.get_input_class(field)
|
|
168
|
-
css_class += css
|
|
169
|
-
if field.errors:
|
|
170
|
-
error_border_class = css_container.error_border
|
|
171
|
-
css_class = re.sub(r"border-\S+", error_border_class, css_class)
|
|
172
|
-
|
|
173
|
-
widget.attrs["class"] = css_class
|
|
174
|
-
|
|
175
|
-
# HTML5 required attribute
|
|
176
|
-
if html5_required and field.field.required and "required" not in widget.attrs:
|
|
177
|
-
if field.field.widget.__class__.__name__ != "RadioSelect":
|
|
178
|
-
widget.attrs["required"] = "required"
|
|
179
|
-
|
|
180
|
-
# classes passed in via the template are added here
|
|
181
|
-
for attribute_name, attribute in attr.items():
|
|
182
|
-
attribute_name = template.Variable(attribute_name).resolve(context)
|
|
183
|
-
|
|
184
|
-
if attribute_name in widget.attrs:
|
|
185
|
-
widget.attrs[attribute_name] += " " + template.Variable(attribute).resolve(context)
|
|
186
|
-
else:
|
|
187
|
-
widget.attrs[attribute_name] = template.Variable(attribute).resolve(context)
|
|
188
|
-
|
|
189
|
-
return str(field)
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
@register.tag(name="daisyui_field")
|
|
193
|
-
def daisyui_field(parser, token):
|
|
194
|
-
"""
|
|
195
|
-
{% daisyui_field field attrs %}
|
|
196
|
-
"""
|
|
197
|
-
token = token.split_contents()
|
|
198
|
-
field = token.pop(1)
|
|
199
|
-
attrs = {}
|
|
200
|
-
|
|
201
|
-
# We need to pop tag name, or pairwise would fail
|
|
202
|
-
token.pop(0)
|
|
203
|
-
for attribute_name, value in pairwise(token):
|
|
204
|
-
attrs[attribute_name] = value
|
|
205
|
-
|
|
206
|
-
return CrispyDaisyUiFieldNode(field, attrs)
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
@register.simple_tag()
|
|
210
|
-
def crispy_addon(field, append="", prepend="", form_show_labels=True):
|
|
211
|
-
"""
|
|
212
|
-
Renders a form field using bootstrap's prepended or appended text::
|
|
213
|
-
|
|
214
|
-
{% crispy_addon form.my_field prepend="$" append=".00" %}
|
|
215
|
-
|
|
216
|
-
You can also just prepend or append like so
|
|
217
|
-
|
|
218
|
-
{% crispy_addon form.my_field prepend="$" %}
|
|
219
|
-
{% crispy_addon form.my_field append=".00" %}
|
|
220
|
-
"""
|
|
221
|
-
if field:
|
|
222
|
-
context = Context({"field": field, "form_show_errors": True, "form_show_labels": form_show_labels})
|
|
223
|
-
template = loader.get_template("%s/layout/prepended_appended_text.html" % get_template_pack())
|
|
224
|
-
context["crispy_prepended_text"] = prepend
|
|
225
|
-
context["crispy_appended_text"] = append
|
|
226
|
-
|
|
227
|
-
if not prepend and not append:
|
|
228
|
-
raise TypeError("Expected a prepend and/or append argument")
|
|
229
|
-
|
|
230
|
-
context = context.flatten()
|
|
231
|
-
|
|
232
|
-
return template.render(context)
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
from functools import lru_cache
|
|
2
|
-
|
|
3
|
-
from django import template
|
|
4
|
-
from django.conf import settings
|
|
5
|
-
from django.forms import boundfield
|
|
6
|
-
from django.forms.formsets import BaseFormSet
|
|
7
|
-
from django.template import Context
|
|
8
|
-
from django.template.loader import get_template
|
|
9
|
-
from django.utils.safestring import mark_safe
|
|
10
|
-
|
|
11
|
-
from crispy_forms.exceptions import CrispyError
|
|
12
|
-
from crispy_forms.utils import TEMPLATE_PACK, flatatt
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@lru_cache()
|
|
16
|
-
def uni_formset_template(template_pack=TEMPLATE_PACK):
|
|
17
|
-
return get_template("%s/uni_formset.html" % template_pack)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@lru_cache()
|
|
21
|
-
def uni_form_template(template_pack=TEMPLATE_PACK):
|
|
22
|
-
return get_template("%s/uni_form.html" % template_pack)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
register = template.Library()
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
@register.filter(name="crispy")
|
|
29
|
-
def as_crispy_form(
|
|
30
|
-
form, template_pack=TEMPLATE_PACK, label_class="block text-sm font-bold mb-1", field_class="mb-3"
|
|
31
|
-
):
|
|
32
|
-
"""
|
|
33
|
-
The original and still very useful way to generate a div elegant form/formset::
|
|
34
|
-
|
|
35
|
-
{% load daisyui_filters %}
|
|
36
|
-
|
|
37
|
-
<form class="uniForm" method="post">
|
|
38
|
-
{% csrf_token %}
|
|
39
|
-
{{ myform|crispy }}
|
|
40
|
-
</form>
|
|
41
|
-
|
|
42
|
-
or, if you want to explicitly set the template pack::
|
|
43
|
-
|
|
44
|
-
{{ myform|crispy:"bootstrap" }}
|
|
45
|
-
|
|
46
|
-
In ``bootstrap3`` or ``bootstrap4`` for horizontal forms you can do::
|
|
47
|
-
|
|
48
|
-
{{ myform|label_class:"col-lg-2",field_class:"col-lg-8" }}
|
|
49
|
-
"""
|
|
50
|
-
c = Context(
|
|
51
|
-
{
|
|
52
|
-
"field_class": field_class,
|
|
53
|
-
"field_template": "%s/field.html" % template_pack,
|
|
54
|
-
"form_show_errors": True,
|
|
55
|
-
"form_show_labels": True,
|
|
56
|
-
"label_class": label_class,
|
|
57
|
-
}
|
|
58
|
-
).flatten()
|
|
59
|
-
if isinstance(form, BaseFormSet):
|
|
60
|
-
template = uni_formset_template(template_pack)
|
|
61
|
-
c["formset"] = form
|
|
62
|
-
else:
|
|
63
|
-
template = uni_form_template(template_pack)
|
|
64
|
-
c["form"] = form
|
|
65
|
-
|
|
66
|
-
return template.render(c)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
@register.filter(name="as_crispy_errors")
|
|
70
|
-
def as_crispy_errors(form, template_pack=TEMPLATE_PACK):
|
|
71
|
-
"""
|
|
72
|
-
Renders only form errors the same way as django-crispy-forms::
|
|
73
|
-
|
|
74
|
-
{% load crispy_forms_tags %}
|
|
75
|
-
{{ form|as_crispy_errors }}
|
|
76
|
-
|
|
77
|
-
or::
|
|
78
|
-
|
|
79
|
-
{{ form|as_crispy_errors:"bootstrap" }}
|
|
80
|
-
"""
|
|
81
|
-
if isinstance(form, BaseFormSet):
|
|
82
|
-
template = get_template("%s/errors_formset.html" % template_pack)
|
|
83
|
-
c = Context({"formset": form}).flatten()
|
|
84
|
-
else:
|
|
85
|
-
template = get_template("%s/errors.html" % template_pack)
|
|
86
|
-
c = Context({"form": form}).flatten()
|
|
87
|
-
|
|
88
|
-
return template.render(c)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
@register.filter(name="as_crispy_field")
|
|
92
|
-
def as_crispy_field(field, template_pack=TEMPLATE_PACK, label_class="", field_class=""):
|
|
93
|
-
"""
|
|
94
|
-
Renders a form field like a django-crispy-forms field::
|
|
95
|
-
|
|
96
|
-
{% load crispy_forms_tags %}
|
|
97
|
-
{{ form.field|as_crispy_field }}
|
|
98
|
-
|
|
99
|
-
or::
|
|
100
|
-
|
|
101
|
-
{{ form.field|as_crispy_field:"daisyui" }}
|
|
102
|
-
"""
|
|
103
|
-
if not isinstance(field, boundfield.BoundField) and settings.DEBUG:
|
|
104
|
-
raise CrispyError("|as_crispy_field got passed an invalid or inexistent field")
|
|
105
|
-
|
|
106
|
-
attributes = {
|
|
107
|
-
"field": field,
|
|
108
|
-
"form_show_errors": True,
|
|
109
|
-
"form_show_labels": True,
|
|
110
|
-
"label_class": label_class,
|
|
111
|
-
"field_class": field_class,
|
|
112
|
-
}
|
|
113
|
-
helper = getattr(field.form, "helper", None)
|
|
114
|
-
|
|
115
|
-
template_path = None
|
|
116
|
-
if helper is not None:
|
|
117
|
-
attributes.update(helper.get_attributes(template_pack))
|
|
118
|
-
template_path = helper.field_template
|
|
119
|
-
if not template_path:
|
|
120
|
-
template_path = "%s/field.html" % template_pack
|
|
121
|
-
template = get_template(template_path)
|
|
122
|
-
|
|
123
|
-
c = Context(attributes).flatten()
|
|
124
|
-
return template.render(c)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
@register.filter(name="flatatt")
|
|
128
|
-
def flatatt_filter(attrs):
|
|
129
|
-
return mark_safe(flatatt(attrs))
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
LICENSE
|
|
2
|
-
README.md
|
|
3
|
-
pyproject.toml
|
|
4
|
-
crispy_daisyui/__init__.py
|
|
5
|
-
crispy_daisyui/daisyui.py
|
|
6
|
-
crispy_daisyui/layout.py
|
|
7
|
-
crispy_daisyui.egg-info/PKG-INFO
|
|
8
|
-
crispy_daisyui.egg-info/SOURCES.txt
|
|
9
|
-
crispy_daisyui.egg-info/dependency_links.txt
|
|
10
|
-
crispy_daisyui.egg-info/requires.txt
|
|
11
|
-
crispy_daisyui.egg-info/top_level.txt
|
|
12
|
-
crispy_daisyui/templates/daisyui/display_form.html
|
|
13
|
-
crispy_daisyui/templates/daisyui/errors.html
|
|
14
|
-
crispy_daisyui/templates/daisyui/errors_formset.html
|
|
15
|
-
crispy_daisyui/templates/daisyui/field.html
|
|
16
|
-
crispy_daisyui/templates/daisyui/inputs.html
|
|
17
|
-
crispy_daisyui/templates/daisyui/table_inline_formset.html
|
|
18
|
-
crispy_daisyui/templates/daisyui/uni_form.html
|
|
19
|
-
crispy_daisyui/templates/daisyui/uni_formset.html
|
|
20
|
-
crispy_daisyui/templates/daisyui/whole_uni_form.html
|
|
21
|
-
crispy_daisyui/templates/daisyui/whole_uni_formset.html
|
|
22
|
-
crispy_daisyui/templates/daisyui/layout/alert.html
|
|
23
|
-
crispy_daisyui/templates/daisyui/layout/baseinput.html
|
|
24
|
-
crispy_daisyui/templates/daisyui/layout/button.html
|
|
25
|
-
crispy_daisyui/templates/daisyui/layout/checkbox.html
|
|
26
|
-
crispy_daisyui/templates/daisyui/layout/checkboxselectmultiple.html
|
|
27
|
-
crispy_daisyui/templates/daisyui/layout/column.html
|
|
28
|
-
crispy_daisyui/templates/daisyui/layout/div.html
|
|
29
|
-
crispy_daisyui/templates/daisyui/layout/field_errors.html
|
|
30
|
-
crispy_daisyui/templates/daisyui/layout/field_errors_block.html
|
|
31
|
-
crispy_daisyui/templates/daisyui/layout/field_with_buttons.html
|
|
32
|
-
crispy_daisyui/templates/daisyui/layout/fieldset.html
|
|
33
|
-
crispy_daisyui/templates/daisyui/layout/formactions.html
|
|
34
|
-
crispy_daisyui/templates/daisyui/layout/help_text.html
|
|
35
|
-
crispy_daisyui/templates/daisyui/layout/help_text_and_errors.html
|
|
36
|
-
crispy_daisyui/templates/daisyui/layout/inline_field.html
|
|
37
|
-
crispy_daisyui/templates/daisyui/layout/prepended_appended_text.html
|
|
38
|
-
crispy_daisyui/templates/daisyui/layout/radioselect.html
|
|
39
|
-
crispy_daisyui/templates/daisyui/layout/radioselect_inline.html
|
|
40
|
-
crispy_daisyui/templates/daisyui/layout/row.html
|
|
41
|
-
crispy_daisyui/templates/daisyui/layout/select.html
|
|
42
|
-
crispy_daisyui/templates/daisyui/layout/select_option.html
|
|
43
|
-
crispy_daisyui/templates/daisyui/layout/toggle.html
|
|
44
|
-
crispy_daisyui/templatetags/__init__.py
|
|
45
|
-
crispy_daisyui/templatetags/daisyui_field.py
|
|
46
|
-
crispy_daisyui/templatetags/daisyui_filters.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|