Metadata-Version: 2.4
Name: feincms-button
Version: 26.8.1
Summary: Bootstrap Button element for FeinCMS
Author-email: Basil Shubin <basil.shubin@gmail.com>
License-Expression: Apache-2.0
Project-URL: download, https://github.com/bashu/feincms-button/zipball/master
Project-URL: homepage, https://github.com/bashu/feincms-button/
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: django>=5.2
Requires-Dist: feincms>=26
Dynamic: license-file

feincms-button
==============

.. image:: https://badge.fury.io/py/feincms-button.svg
    :target: https://badge.fury.io/py/feincms-button

.. image:: https://img.shields.io/pypi/pyversions/feincms-button.svg
    :target: https://pypi.python.org/pypi/feincms-button/

.. image:: https://img.shields.io/pypi/djversions/feincms-button.svg
    :target: https://pypi.python.org/pypi/feincms-button/

.. image:: https://github.com/bashu/feincms-button/actions/workflows/test.yml/badge.svg
    :target: https://github.com/bashu/feincms-button/actions/workflows/test.yml

Displaying a Bootstrap Button_ in text.

This button can be used for navigation, for example at the end of a text block. These buttons can't be used in forms.

Installation
------------

First make sure the project is configured for feincms_.

Then add the following settings:

.. code-block:: python

    INSTALLED_APPS += (
        'feincms_button',
    )

Now, you can create ``ButtonContent`` content type:

.. code-block:: python

    from feincms.module.page.models import Page
    from feincms_button.contents import ButtonContent

    Page.create_content_type(ButtonContent)


Frontend styling
----------------

The button is rendered with the HTML that Bootstrap prescribes:

.. code-block:: html+django

    <a class="btn btn-secondary" href="#" role="button">Link</a>

The standard Bootstrap CSS will provide a reasonable styling for this, which can either be overwritten, or replaced in your own CSS files.
The defaults provided by Bootstrap are defined here: https://github.com/twbs/bootstrap/blob/main/scss/_buttons.scss

When you use Sass, you can also override the Sass variables.


Configuration
-------------

When desired, the following settings can be overwritten:

.. code-block:: python

    from django.utils.translation import pgettext_lazy

    FEINCMS_BUTTON_STYLES = (
        ('btn-secondary', pgettext_lazy("button-style", u"Default")),
        ('btn-primary', pgettext_lazy("button-style", u"Primary")),
        ('btn-success', pgettext_lazy("button-style", u"Success")),
        ('btn-info', pgettext_lazy("button-style", u"Info")),
        ('btn-warning', pgettext_lazy("button-style", u"Warning")),
        ('btn-danger', pgettext_lazy("button-style", u"Danger")),
        ('btn-link', pgettext_lazy("button-style", u"Link")),
    )

    FEINCMS_BUTTON_SIZES = (
        ('', pgettext_lazy("button-size", u"Default")),
        ('btn-lg', pgettext_lazy("button-size", u"Large")),
        ('btn-sm', pgettext_lazy("button-size", u"Small")),
    )

By default, the standard Bootstrap button classes are used.
These can be redefined when the project uses other classes for the buttons.

Contributing
------------

If you like this module, forked it, or would like to improve it, please let us know!
Pull requests are welcome too. :-)

.. _feincms: https://github.com/feincms/feincms
.. _Button: https://getbootstrap.com/docs/5.3/components/buttons/

Changes
-------

26.8.0 (2026-08-14)
~~~~~~~~~~~~~~~~~~~

* Required FeinCMS 26+ and updated ``ButtonContent.render()`` for FeinCMS's
  ``AutoRenderTuple``-based render API (FeinCMS 22.x+), replacing the removed
  ``feincms._internal.ct_render_to_string``.
* Dropped Python < 3.10 and Django < 5.2 support; added Django 6.0 / 6.1 support.
* Migrated the rendered button markup and default styles/sizes from Bootstrap 3
  to Bootstrap 5.

2.0.1 (2021-11-28)
~~~~~~~~~~~~~~~~~~

* Added ru translation.

2.0.0 (2021-11-27)
~~~~~~~~~~~~~~~~~~

* Added Django 3+ support.
* Dropped Python 2.7 support.
* Dropped Django 1.10 / 1.11 support.
