Skip to content

Commit

Permalink
更新了基础搜索花的功能
Browse files Browse the repository at this point in the history
  • Loading branch information
txbxxx committed Dec 22, 2023
1 parent 15a58be commit ee0eecd
Show file tree
Hide file tree
Showing 94 changed files with 5,394 additions and 175 deletions.
6 changes: 2 additions & 4 deletions .idea/鲜花库存管理系统.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2020 David Smith and contributors.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
123 changes: 123 additions & 0 deletions flowers/Lib/site-packages/crispy_bootstrap5-2023.10.dist-info/METADATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
Metadata-Version: 2.1
Name: crispy-bootstrap5
Version: 2023.10
Summary: Bootstrap5 template pack for django-crispy-forms
Author: David Smith
License: MIT
Project-URL: CI, https://github.com/django-crispy-forms/crispy-bootstrap5/actions
Project-URL: Changelog, https://github.com/django-crispy-forms/crispy-bootstrap5/releases
Project-URL: Homepage, https://github.com/django-crispy-forms/crispy-bootstrap5
Project-URL: Issues, https://github.com/django-crispy-forms/crispy-bootstrap5/issues
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: django >=4.2
Requires-Dist: django-crispy-forms >=2
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pytest-django ; extra == 'test'

# crispy-bootstrap5

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smithdc1/crispy-bootstrap5/blob/main/LICENSE)

Bootstrap5 template pack for django-crispy-forms

## Installation

Install this plugin using `pip`:
```bash
$ pip install crispy-bootstrap5
```

## Usage

You will need to update your project's settings file to add ``crispy_forms``
and ``crispy_bootstrap5`` to your projects ``INSTALLED_APPS``. Also set
``bootstrap5`` as and allowed template pack and as the default template pack
for your project

```python
INSTALLED_APPS = (
...
"crispy_forms",
"crispy_bootstrap5",
...
)

CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"

CRISPY_TEMPLATE_PACK = "bootstrap5"
```

## What's new?

Bootstrap 5 introduces [floating labels](https://getbootstrap.com/docs/5.0/forms/floating-labels/).
This template pack include a layout object to use this input type

```python
from crispy_bootstrap5.bootstrap5 import FloatingField

# then in your Layout
... Layout(
FloatingField("first_name"),
)
```

Accordions also have new features, such as [Accordion flush](https://getbootstrap.com/docs/5.0/components/accordion/#flush) and [Always open](https://getbootstrap.com/docs/5.0/components/accordion/#always-open).
There is a new layout object to use them

```python
from crispy_bootstrap5.bootstrap5 import BS5Accordion

# then in your Layout
# if not informed, flush and always_open default to False
... Layout(
BS5Accordion(
AccordionGroup("group name", "form_field_1", "form_field_2"),
AccordionGroup("another group name", "form_field"),
flush=True,
always_open=True
)
)
```

## Development

To contribute to this library, first checkout the code. Then create a new virtual environment:

```bash
cd crispy-bootstrap5
python -mvenv venv
source venv/bin/activate
```

Or if you are using `pipenv`:
```bash
pipenv shell
```

Now install the dependencies and tests:
```bash
pip install -e '.[test]'
```

To run the tests:
```bash
pytest
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
crispy_bootstrap5-2023.10.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
crispy_bootstrap5-2023.10.dist-info/LICENSE,sha256=9GRf5DJZqTaPbGeDJunlaPNZii4Bj8FuIQAP3wmsUE0,1072
crispy_bootstrap5-2023.10.dist-info/METADATA,sha256=MvPZlhMnc8BKbau5WlTb18VVg0WGYX3_ofpDB8UluPk,3519
crispy_bootstrap5-2023.10.dist-info/RECORD,,
crispy_bootstrap5-2023.10.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
crispy_bootstrap5-2023.10.dist-info/WHEEL,sha256=Xo9-1PvkuimrydujYJAjF7pCkriuXBpUPEjma1nZyJ0,92
crispy_bootstrap5-2023.10.dist-info/top_level.txt,sha256=DVPspp5GWXFkFLwvl1uB6IHzlYLc3CzC-QaNug1R_rU,18
crispy_bootstrap5/__init__.py,sha256=cM2Dt5-WKOKUzVYuanvNwW1ZoNijqaU0DL5Jf0wxxLI,24
crispy_bootstrap5/__pycache__/__init__.cpython-38.pyc,,
crispy_bootstrap5/__pycache__/bootstrap5.cpython-38.pyc,,
crispy_bootstrap5/bootstrap5.py,sha256=xVPCh6eH7c9WGmhLbENg81nsS-JDW-WWuhD_FYEWj6w,926
crispy_bootstrap5/templates/bootstrap5/accordion-group.html,sha256=szPb9TvZWY3QXm6IP0CvvAlXzbPJUx2dP1U2xPDCzu0,676
crispy_bootstrap5/templates/bootstrap5/accordion.html,sha256=eBXZh5cHAY9cPLsru-KOCvjoklLDo5EexhYL-1WU6wQ,133
crispy_bootstrap5/templates/bootstrap5/betterform.html,sha256=65kED-HynWsciwYbkWzEvUW2gFJ1Z8DP493tChiAwfc,668
crispy_bootstrap5/templates/bootstrap5/display_form.html,sha256=xzwd4dr4EnnXuwjw_edcVNYF7sB0yxt0dLKpLIwfOCo,264
crispy_bootstrap5/templates/bootstrap5/errors.html,sha256=983yW0fIrrTKhIJ5zNXaGa3zLON9h_ClkBLD5rBHqJU,295
crispy_bootstrap5/templates/bootstrap5/errors_formset.html,sha256=IGCJBqbKPtnmDvQocMODLcKwFGYiNq_xlRZAU7aIU-4,306
crispy_bootstrap5/templates/bootstrap5/field.html,sha256=wM-mUv9ZgpDwyc4Zh41TL78rfy3GpIUerNrzLiL2mYI,3990
crispy_bootstrap5/templates/bootstrap5/inputs.html,sha256=kxL9yAPQ-bMr5C3YfH7I4gPbk2w9WvJm36phwVGJod4,404
crispy_bootstrap5/templates/bootstrap5/layout/alert.html,sha256=OA4lQ3WLmpqTqFpxWVW1-GhEoBPOQR9CyhcnNkJvNSY,313
crispy_bootstrap5/templates/bootstrap5/layout/attrs.html,sha256=9ylIPv5EZg-rx2qPLgobRkw6Zq_WJSM8kt106PpSYa0,172
crispy_bootstrap5/templates/bootstrap5/layout/baseinput.html,sha256=VxgzO0gjuKerbwKjYoSA0KSQ6mgNmhRGy_keQtqIbec,423
crispy_bootstrap5/templates/bootstrap5/layout/button.html,sha256=evlO80en9FkbW3UayLPTNUZXAYvgr3slSAsGPKXs96M,67
crispy_bootstrap5/templates/bootstrap5/layout/buttonholder.html,sha256=Hizf_vMjGjfMtnRlIhIC01QMuOCumlZCKcBG518d4m8,212
crispy_bootstrap5/templates/bootstrap5/layout/checkboxselectmultiple_inline.html,sha256=UZ9QlnGKG9S2wVIPB5sEclWEeORhcjnhbTfGTiRcB3Y,751
crispy_bootstrap5/templates/bootstrap5/layout/column.html,sha256=V8KZhnphb7X7_6VrK2qFPfBijiBNvCJXeLoBN-j7EW8,247
crispy_bootstrap5/templates/bootstrap5/layout/div.html,sha256=b1an9CWUNJAgk0EGTLfQyR_dlTPmLl-D2jPDrGsI7qo,178
crispy_bootstrap5/templates/bootstrap5/layout/field_errors.html,sha256=pDtfFZMV70-zUPS-1J_fXvD-MCxkzD2RYcllUH1uSYU,236
crispy_bootstrap5/templates/bootstrap5/layout/field_errors_block.html,sha256=Tkzqs0r7NVhIHYg9segv8cDaiyjD1KwsLRUOV4VdFf4,230
crispy_bootstrap5/templates/bootstrap5/layout/field_file.html,sha256=XmtqT_pmlF-WNRxHZZxdkcTNxHt7fbPGT7K1Vin6zko,1511
crispy_bootstrap5/templates/bootstrap5/layout/field_with_buttons.html,sha256=z2_7JRTu_8ypf4LNDCD2iClIUUngBWP60hMfao3wmTE,1436
crispy_bootstrap5/templates/bootstrap5/layout/fieldset.html,sha256=5JQ5EscLUdYUoTx9TMj_fTRgiH6HljgFyk6qj4QDam4,310
crispy_bootstrap5/templates/bootstrap5/layout/floating_field.html,sha256=Zin5Yzdj7ekZx_1tIzBQRVCLKFCdoSO6iSSsWTlnK70,1258
crispy_bootstrap5/templates/bootstrap5/layout/formactions.html,sha256=g27KBW8AQhARBGNPIrktTofot9jrR65crbqGunRBnpw,264
crispy_bootstrap5/templates/bootstrap5/layout/help_text.html,sha256=j0gyNxh3_YDwgdDGp1zQOk458_iTuOtbkL8L-tq12Fg,343
crispy_bootstrap5/templates/bootstrap5/layout/help_text_and_errors.html,sha256=gO07f4Tw0rSKm8sa8gReF3dXrsSXdHDA_B5P3Ltmwjw,382
crispy_bootstrap5/templates/bootstrap5/layout/inline_field.html,sha256=chhImsW7F9hSzmnOaJXVKfEfR7oTHtJZrzDzjtCG8Iw,1034
crispy_bootstrap5/templates/bootstrap5/layout/multifield.html,sha256=v9gWbmWAGVDkxsJCut0X7tZ6JjYyOOW0t8Q3FToJrY8,533
crispy_bootstrap5/templates/bootstrap5/layout/prepended_appended_text.html,sha256=zGd1x8-7oqpLBWL6mvxf9jN44PWmRev6FNzCpkEvZF8,2410
crispy_bootstrap5/templates/bootstrap5/layout/radio_checkbox_select.html,sha256=DvaPwk80GlHx7g3ucZdkrS4JxRSQQq_GTkd_ayjhVRw,1283
crispy_bootstrap5/templates/bootstrap5/layout/radioselect_inline.html,sha256=UZ9QlnGKG9S2wVIPB5sEclWEeORhcjnhbTfGTiRcB3Y,751
crispy_bootstrap5/templates/bootstrap5/layout/row.html,sha256=citmIf-8hAi8kqoqBFoo5LbdadpGe0pViTOZGZpdhec,149
crispy_bootstrap5/templates/bootstrap5/layout/tab-link.html,sha256=NXblprA3m6FPZN6_litOSRJmWKEUkkpJapIiCQ0jZ6k,206
crispy_bootstrap5/templates/bootstrap5/layout/tab.html,sha256=L8W4DbWYO0yvfSzM0_fuWWZg9z-fO2DIwFrgKiTa804,173
crispy_bootstrap5/templates/bootstrap5/layout/uneditable_input.html,sha256=xchYA-hWDHIATxuW1wa3tIWP3VKT_qkb4d6w2mm3VNA,680
crispy_bootstrap5/templates/bootstrap5/table_inline_formset.html,sha256=1uMPj_aGzy87dd9ZZAR_-W-Ule4X0fpVzuCJKTyItZg,2066
crispy_bootstrap5/templates/bootstrap5/uni_form.html,sha256=EI0ShNWk4dENnai7ADFIj8R59LuVpY8LDI2YhvwJrPo,309
crispy_bootstrap5/templates/bootstrap5/uni_formset.html,sha256=4ag7O0_EH1WQ4S2_TItPdZgropu4i08_1lSmyF-L1BQ,230
crispy_bootstrap5/templates/bootstrap5/whole_uni_form.html,sha256=hlMZGcUOpAftJVsx1vRlUmqRCQfRUXoWVb5bZ_cWoDM,461
crispy_bootstrap5/templates/bootstrap5/whole_uni_formset.html,sha256=cmx7D21Jrwryt8NGBjLrwhQGSPVUHkFLyqYElFxDtZ4,844
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.41.3)
Root-Is-Purelib: true
Tag: py3-none-any

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
crispy_bootstrap5
1 change: 1 addition & 0 deletions flowers/Lib/site-packages/crispy_bootstrap5/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "2023.10"
29 changes: 29 additions & 0 deletions flowers/Lib/site-packages/crispy_bootstrap5/bootstrap5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from crispy_forms.bootstrap import Accordion
from crispy_forms.layout import Field


class FloatingField(Field):
template = "bootstrap5/layout/floating_field.html"


class BS5Accordion(Accordion):
"""
Bootstrap5 Accordion menu object. It wraps `AccordionGroup` objects in a
container. It also allows the usage of accordion-flush, introduced in bootstrap5::
BS5Accordion(
AccordionGroup("group name", "form_field_1", "form_field_2"),
AccordionGroup("another group name", "form_field"),
flush=True,
always_open=True
)
"""

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.flush = kwargs.pop("flush", False)
self.always_open = kwargs.pop("always_open", False)

if self.always_open:
for accordion_group in self.fields:
accordion_group.always_open = True
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<div class="accordion-item">
<h2 class="accordion-header">
<button class="accordion-button{% if not div.active %} collapsed{% endif %}" type="button" data-bs-toggle="collapse" data-bs-target="#{{ div.css_id }}" aria-expanded="true"
aria-controls="{{ div.css_id }}">
{{ div.name }}
</button>
</h2>

<div id="{{ div.css_id }}" class="accordion-collapse collapse{% if div.active %} show{% endif %}"
aria-labelledby="{{ div.css_id }}" {% if not div.always_open %} data-bs-parent="#{{ div.data_parent }}" {% endif %}>
<div class="accordion-body">
{{ fields|safe }}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="accordion{% if accordion.flush %} accordion-flush{% endif %}" id="{{ accordion.css_id }}">
{{ content|safe }}
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% for fieldset in form.fieldsets %}
<fieldset class="fieldset-{{ forloop.counter }} {{ fieldset.classes }}">
{% if fieldset.legend %}
<legend>{{ fieldset.legend }}</legend>
{% endif %}

{% if fieldset.description %}
<p class="description">{{ fieldset.description }}</p>
{% endif %}

{% for field in fieldset %}
{% if field.is_hidden %}
{{ field }}
{% else %}
{% include "bootstrap5/field.html" %}
{% endif %}
{% endfor %}
{% if not forloop.last or not fieldset_open %}
</fieldset>
{% endif %}
{% endfor %}

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% if form.form_html %}
{% if include_media %}{{ form.media }}{% endif %}
{% if form_show_errors %}
{% include "bootstrap5/errors.html" %}
{% endif %}
{{ form.form_html }}
{% else %}
{% include "bootstrap5/uni_form.html" %}
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{% if form.non_field_errors %}
<div class="alert alert-block alert-danger">
{% if form_error_title %}<h4 class="alert-heading">{{ form_error_title }}</h4>{% endif %}
<ul class="m-0">
{{ form.non_field_errors|unordered_list }}
</ul>
</div>
{% endif %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{% if formset.non_form_errors %}
<div class="alert alert-block alert-danger">
{% if formset_error_title %}<h4 class="alert-heading">{{ formset_error_title }}</h4>{% endif %}
<ul class="m-0">
{{ formset.non_form_errors|unordered_list }}
</ul>
</div>
{% endif %}

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% load crispy_forms_field %}

{% if field.is_hidden %}
{{ field }}
{% else %}
{% if field|is_checkbox and tag != "td" %}
<div class="mb-3{% if 'form-horizontal' in form_class %} row{% endif %}">
{% if label_class %}
<div class="{% for offset in bootstrap_checkbox_offsets %}{{ offset|slice:"7:14" }}{{ offset|slice:"4:7" }}{{ offset|slice:"14:16" }} {% endfor %}{{ field_class }}">
{% endif %}
{% endif %}
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" class="mb-3{% if field|is_checkbox and form_show_labels %} form-check{% else %}{% if 'form-horizontal' in form_class %} row{% endif %}{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label and not field|is_checkbox and form_show_labels %}
{# not field|is_radioselect in row below can be removed once Django 3.2 is no longer supported #}
<label {% if field.id_for_label and not field|is_radioselect %}for="{{ field.id_for_label }}"{% endif %} class="{% if 'form-horizontal' in form_class %}col-form-label{% else %}form-label{% endif %}{% if label_class %} {{ label_class }}{% endif %}{% if field.field.required %} requiredField{% endif %}">
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
{% endif %}

{% if field|is_checkboxselectmultiple or field|is_radioselect %}
{% include 'bootstrap5/layout/radio_checkbox_select.html' %}
{% endif %}

{% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
{% if field|is_checkbox and form_show_labels %}
{% if field.errors %}
{% crispy_field field 'class' 'form-check-input is-invalid' %}
{% else %}
{% crispy_field field 'class' 'form-check-input' %}
{% endif %}
<label for="{{ field.id_for_label }}" class="form-check-label{% if field.field.required %} requiredField{% endif %}">
{{ field.label }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
{% include 'bootstrap5/layout/help_text_and_errors.html' %}
{% else %}
{% if field_class %}<div class="{{ field_class }}">{% endif %}
{% if field|is_file %}
{% include 'bootstrap5/layout/field_file.html' %}
{% elif field|is_select %}
{% if field.errors %}
{% crispy_field field 'class' 'form-select is-invalid' %}
{% else %}
{% crispy_field field 'class' 'form-select' %}
{% endif %}
{% elif field|is_checkbox %}
{% if field.errors %}
{% crispy_field field 'class' 'form-check-input is-invalid' %}
{% else %}
{% crispy_field field 'class' 'form-check-input' %}
{% endif %}
{% elif field.errors %}
{% crispy_field field 'class' 'form-control is-invalid' %}
{% else %}
{% crispy_field field 'class' 'form-control' %}
{% endif %}
{% if not field|is_file %}
{% include 'bootstrap5/layout/help_text_and_errors.html' %}
{% endif %}
{% if field_class %}</div>{% endif %}
{% endif %}
{% endif %}
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
{% if field|is_checkbox and tag != "td" %}
{% if label_class %}
</div>
{% endif %}
</div>
{% endif %}
{% endif %}
Loading

0 comments on commit ee0eecd

Please sign in to comment.