- commit
- 5cea3206313e081715ca153c74e80cc1a4402547
- parent
- 09caa994a3f2991515c6859c0acb46c8f99bbba9
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-08-10 06:54
convert README to markdown
Diffstat
| R | CHANGES.rst -> CHANGES.md | 0 | |
| A | README.md | 74 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| D | README.rst | 77 | ------------------------------------------------------------ |
| M | setup.py | 3 | ++- |
4 files changed, 76 insertions, 78 deletions
diff --git a/CHANGES.rst b/CHANGES.md
diff --git a/README.md b/README.md
@@ -0,0 +1,74 @@
-1 1 Bootstrap 4 forms for Django
-1 2 ============================
-1 3
-1 4 Bootstrap 4 integration for django using [widget templates] that were
-1 5 introduced in Django 1.11.
-1 6
-1 7 Motivation
-1 8 ----------
-1 9
-1 10 This library is meant to be a drop-in replacement for [django-bootstrap4]. See
-1 11 below for a list of differences. I really like that library, but it is hard to
-1 12 customize some things because everything is done in python functions. By using
-1 13 widget templates, I hope this library is more flexible.
-1 14
-1 15 Installation
-1 16 ------------
-1 17
-1 18 Install with pip:
-1 19
-1 20 pip install django-bs4
-1 21
-1 22 After that you have to add it to `INSTALLED_APPS`. You also need to make sure
-1 23 that the correct `FORM_RENDERER` is selected and `django.forms` is in
-1 24 `INSTALLED_APPS` (after `django_bs4`). This is required so that widget
-1 25 templates can be overwritten:
-1 26
-1 27 INSTALLED_APPS = [
-1 28 …
-1 29 'django_bs4',
-1 30 …
-1 31 'django.forms',
-1 32 …
-1 33 ]
-1 34
-1 35 FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'
-1 36
-1 37 Usage
-1 38 -----
-1 39
-1 40 The following template tags are included in the `bootstrap4` library:
-1 41
-1 42 - `bootstrap_field {boundfield}` - Render a single field.
-1 43 - `bootstrap_form {form}` - Render errors and all fields for a form. The
-1 44 `<form>` element itself is not included.
-1 45 - `bootstrap_messages` - Render messages from `django.contrib.messages`.
-1 46 - `bootstrap_pagination {page}` - Render pagination. A `<nav>` element is not
-1 47 included.
-1 48
-1 49 Please refer to the source code for additional parameters.
-1 50
-1 51 Differences to django-bootstrap4
-1 52 --------------------------------
-1 53
-1 54 - Uses widget templates instead of custom renderers. IMHO this makes the code
-1 55 much easier to read and customize. A big downside is that I had to
-1 56 monkey-patch `BoundField.as_widget()` to include some information that
-1 57 would otherwise not be available in the widget templates.
-1 58 - Concentrates on forms fields and does therefore not include some others
-1 59 features.
-1 60 - Uses `small.text-danger` instead of `.invalid-feedback` as it does not
-1 61 depend on DOM location. (see also [twbs/bootstrap\#29439])
-1 62 - Does not use `.is-valid` because I find it confusing with server-side
-1 63 rendering.
-1 64 - Does not include dismiss-buttons for alerts to avoid depending on
-1 65 JavaScript.
-1 66 - Does not include field errors at the top of forms as they are already
-1 67 displayed on the fields themselves.
-1 68 - Improved ARIA support.
-1 69 - You will have to load bootstrap yourself.
-1 70 - No configuration.
-1 71
-1 72 [widget templates]: https://docs.djangoproject.com/en/stable/ref/forms/renderers/#overriding-built-in-widget-templates
-1 73 [django-bootstrap4]: https://github.com/zostera/django-bootstrap4
-1 74 [twbs/bootstrap\#29439]: https://github.com/twbs/bootstrap/issues/29439
diff --git a/README.rst b/README.rst
@@ -1,77 +0,0 @@1 -1 Bootstrap 4 forms for Django2 -1 ============================3 -14 -1 Bootstrap 4 integration for django using `widget templates`_ that were5 -1 introduced in Django 1.11.6 -17 -1 Motivation8 -1 ----------9 -110 -1 This library is meant to be a drop-in replacement for11 -1 `django-bootstrap4`_. See below for a list of differences. I really like12 -1 that library, but it is hard to customize some things because everything13 -1 is done in python functions. By using widget templates, I hope this14 -1 library is more flexible.15 -116 -1 Installation17 -1 ------------18 -119 -1 Install with pip::20 -121 -1 pip install django-bs422 -123 -1 After that you have to add it to ``INSTALLED_APPS``. You also need to24 -1 make sure that the correct ``FORM_RENDERER`` is selected and25 -1 ``django.forms`` is in ``INSTALLED_APPS`` (after ``django_bs4``). This26 -1 is required so that widget templates can be overwritten::27 -128 -1 INSTALLED_APPS = [29 -1 …30 -1 'django_bs4',31 -1 …32 -1 'django.forms',33 -1 …34 -1 ]35 -136 -1 FORM_RENDERER = 'django.forms.renderers.TemplatesSetting'37 -138 -1 Usage39 -1 -----40 -141 -1 The following template tags are included in the ``bootstrap4`` library:42 -143 -1 - ``bootstrap_field {boundfield}`` - Render a single field.44 -1 - ``bootstrap_form {form}`` - Render errors and all fields for a form.45 -1 The ``<form>`` element itself is not included.46 -1 - ``bootstrap_messages`` - Render messages from47 -1 ``django.contrib.messages``.48 -1 - ``bootstrap_pagination {page}`` - Render pagination. A ``<nav>``49 -1 element is not included.50 -151 -1 Please refer to the source code for additional parameters.52 -153 -1 Differences to django-bootstrap454 -1 --------------------------------55 -156 -1 - Uses widget templates instead of custom renderers. IMHO this57 -1 makes the code much easier to read and customize. A big downside is58 -1 that I had to monkey-patch ``BoundField.as_widget()`` to include some59 -1 information that would otherwise not be available in the widget60 -1 templates.61 -1 - Concentrates on forms fields and does therefore not include some62 -1 others features.63 -1 - Uses ``small.text-danger`` instead of ``.invalid-feedback`` as it64 -1 does not depend on DOM location. (see also `twbs/bootstrap#29439`_)65 -1 - Does not use ``.is-valid`` because I find it confusing with66 -1 server-side rendering.67 -1 - Does not include dismiss-buttons for alerts to avoid depending on68 -1 JavaScript.69 -1 - Does not include field errors at the top of forms as they are already70 -1 displayed on the fields themselves.71 -1 - Improved ARIA support.72 -1 - You will have to load bootstrap yourself.73 -1 - No configuration.74 -175 -1 .. _widget templates: https://docs.djangoproject.com/en/stable/ref/forms/renderers/#overriding-built-in-widget-templates76 -1 .. _django-bootstrap4: https://github.com/zostera/django-bootstrap477 -1 .. _twbs/bootstrap#29439: https://github.com/twbs/bootstrap/issues/29439
diff --git a/setup.py b/setup.py
@@ -4,7 +4,8 @@ from setuptools import find_packages, setup 4 4 setup( 5 5 name='django-bs4', 6 6 description='simple bootstrap4 support for django',7 -1 long_description=open('README.rst').read(),-1 7 long_description=open('README.md').read(), -1 8 long_description_content_type='text/markdown', 8 9 url='https://github.com/xi/django-bs', 9 10 author='Tobias Bengfort', 10 11 author_email='tobias.bengfort@posteo.de',