django-icons


Namedjango-icons JSON
Version 24.3 PyPI version JSON
download
home_pageNone
SummaryIcons for Django
upload_time2024-04-20 12:08:07
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseBSD 3-Clause License Copyright (c) 2017, Zostera B.V. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords django icons
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-icons

[![CI](https://github.com/zostera/django-icons/workflows/CI/badge.svg?branch=main)](https://github.com/zostera/django-icons/actions?workflow=CI)
[![Coverage Status](https://coveralls.io/repos/github/zostera/django-icons/badge.svg?branch=main)](https://coveralls.io/github/zostera/django-icons?branch=main)
[![Latest PyPI version](https://img.shields.io/pypi/v/django-icons.svg)](https://pypi.python.org/pypi/django-icons)

### Icons for Django

- Define your icons in your settings, with defaults for name, title and other attributes.
- Generate icons using template tags.
- Supports Font Awesome, Material, Bootstrap 3 and images.
- Add other libraries and custom icon sets by subclassing IconRenderer.

### More information

- [PyPI (django-icons)](https://pypi.python.org/pypi/django-icons)
- [Documentation](https://django-icons.readthedocs.io/en/latest/)
- [Bug tracker](http://github.com/zostera/django-icons/issues)

## Installation


Install using pip.

```shell
pip install django-icons
```

In your `settings.py`, add `django_icons` to `INSTALLED_APPS` and define an icon.

```python

INSTALLED_APPS = (
    # ...
    "django_icons",
    # ...
)

DJANGO_ICONS = {
    "ICONS": {
        "edit": {"name": "fa-solid fa-pencil"},
    },
}
```

Render an icon in a Django template.

```djangotemplate
{% load icons %}

<!-- Include your icon library. This example uses Font Awesome 6 through cdnjs.  -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">

{% icon 'edit' %}
```

This will generate the FontAwesome 6 pencil icon in regular style.

```html
<i class="fa-solid fa-pencil"></i>
```

Add extra classes and attributes to your predefined icon.

```djangotemplate
{% load icons %}
{% icon 'edit' extra_classes='fa-2xs my-extra-class' title='Update' %}
```

These will be added to the HTML output.

```html
<i class="fa-solid fa-pencil fa-2xs my-extra-class" title="Update"></i>
```

## Requirements

This package requires a combination of Python and Django that is currently supported.

See "Supported Versions" on <https://www.djangoproject.com/download/>.

## Local installation

**This section assumes you know about local Python versions and virtual environments.**

To clone the repository and install the requirements for local development:

```shell
$ git clone git://github.com/zostera/django-icons.git
$ cd django-icons
$ pip install -e .
$ pip install -U pip -r requirements-dev.txt
```

### Running the demo

You can run the example app:

```shell
cd example && run python manage.py runserver
```

### Running the tests

The test suite requires [tox](https://tox.readthedocs.io/) to be installed. Run the complete test suite like this:

```shell
tox
```

Test for the current environment can be run with the Django `manage.py` command.

```shell
python manage.py test
```

## Origin

Our plans at Zostera for an icon tool originate in <https://github.com/dyve/django-bootstrap3>. We isolated this into a Font Awesome tool in <https://github.com/zostera/django-fa>. When using our own product, we felt that the icon tool provided little improvement over plain HTML. Also, Font Awesome's icon names did not match the intended function of the icon.

This is how we came to think of a library that:

- Took a limited number of arguments
- Converted those arguments into an icon
- Was able to support multiple icon libraries
- Could bind an icon definition to a preset name for easy reuse
- Could easily be extended by users

This is how we came to write and use `django-icons`.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "django-icons",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "django, icons",
    "author": null,
    "author_email": "Dylan Verheul <dylan@dyve.net>",
    "download_url": "https://files.pythonhosted.org/packages/ed/20/2b7af5c94257419c2992608e9ab1d7503a8a5869bae178d5901c76e4c7a5/django_icons-24.3.tar.gz",
    "platform": null,
    "description": "# django-icons\n\n[![CI](https://github.com/zostera/django-icons/workflows/CI/badge.svg?branch=main)](https://github.com/zostera/django-icons/actions?workflow=CI)\n[![Coverage Status](https://coveralls.io/repos/github/zostera/django-icons/badge.svg?branch=main)](https://coveralls.io/github/zostera/django-icons?branch=main)\n[![Latest PyPI version](https://img.shields.io/pypi/v/django-icons.svg)](https://pypi.python.org/pypi/django-icons)\n\n### Icons for Django\n\n- Define your icons in your settings, with defaults for name, title and other attributes.\n- Generate icons using template tags.\n- Supports Font Awesome, Material, Bootstrap 3 and images.\n- Add other libraries and custom icon sets by subclassing IconRenderer.\n\n### More information\n\n- [PyPI (django-icons)](https://pypi.python.org/pypi/django-icons)\n- [Documentation](https://django-icons.readthedocs.io/en/latest/)\n- [Bug tracker](http://github.com/zostera/django-icons/issues)\n\n## Installation\n\n\nInstall using pip.\n\n```shell\npip install django-icons\n```\n\nIn your `settings.py`, add `django_icons` to `INSTALLED_APPS` and define an icon.\n\n```python\n\nINSTALLED_APPS = (\n    # ...\n    \"django_icons\",\n    # ...\n)\n\nDJANGO_ICONS = {\n    \"ICONS\": {\n        \"edit\": {\"name\": \"fa-solid fa-pencil\"},\n    },\n}\n```\n\nRender an icon in a Django template.\n\n```djangotemplate\n{% load icons %}\n\n<!-- Include your icon library. This example uses Font Awesome 6 through cdnjs.  -->\n<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css\">\n\n{% icon 'edit' %}\n```\n\nThis will generate the FontAwesome 6 pencil icon in regular style.\n\n```html\n<i class=\"fa-solid fa-pencil\"></i>\n```\n\nAdd extra classes and attributes to your predefined icon.\n\n```djangotemplate\n{% load icons %}\n{% icon 'edit' extra_classes='fa-2xs my-extra-class' title='Update' %}\n```\n\nThese will be added to the HTML output.\n\n```html\n<i class=\"fa-solid fa-pencil fa-2xs my-extra-class\" title=\"Update\"></i>\n```\n\n## Requirements\n\nThis package requires a combination of Python and Django that is currently supported.\n\nSee \"Supported Versions\" on <https://www.djangoproject.com/download/>.\n\n## Local installation\n\n**This section assumes you know about local Python versions and virtual environments.**\n\nTo clone the repository and install the requirements for local development:\n\n```shell\n$ git clone git://github.com/zostera/django-icons.git\n$ cd django-icons\n$ pip install -e .\n$ pip install -U pip -r requirements-dev.txt\n```\n\n### Running the demo\n\nYou can run the example app:\n\n```shell\ncd example && run python manage.py runserver\n```\n\n### Running the tests\n\nThe test suite requires [tox](https://tox.readthedocs.io/) to be installed. Run the complete test suite like this:\n\n```shell\ntox\n```\n\nTest for the current environment can be run with the Django `manage.py` command.\n\n```shell\npython manage.py test\n```\n\n## Origin\n\nOur plans at Zostera for an icon tool originate in <https://github.com/dyve/django-bootstrap3>. We isolated this into a Font Awesome tool in <https://github.com/zostera/django-fa>. When using our own product, we felt that the icon tool provided little improvement over plain HTML. Also, Font Awesome's icon names did not match the intended function of the icon.\n\nThis is how we came to think of a library that:\n\n- Took a limited number of arguments\n- Converted those arguments into an icon\n- Was able to support multiple icon libraries\n- Could bind an icon definition to a preset name for easy reuse\n- Could easily be extended by users\n\nThis is how we came to write and use `django-icons`.\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause License  Copyright (c) 2017, Zostera B.V. All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "Icons for Django",
    "version": "24.3",
    "project_urls": {
        "Changelog": "https://github.com/zostera/django-icons/blob/main/CHANGELOG.md",
        "Documentation": "https://django-icons.readthedocs.io/",
        "Homepage": "https://github.com/zostera/django-icons",
        "Issues": "https://github.com/zostera/django-icons/issues",
        "Source": "https://github.com/zostera/django-icons"
    },
    "split_keywords": [
        "django",
        " icons"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d8a79329439a648477b5687a9ee6a3b645c0c2340aeeb370c7d11556758dc672",
                "md5": "7add8e81831950fd0edaeffe00777583",
                "sha256": "5dc660b93fb8f27c50065f36290a2557ebba5dc0007aba57003f0fc051e88094"
            },
            "downloads": -1,
            "filename": "django_icons-24.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7add8e81831950fd0edaeffe00777583",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 13338,
            "upload_time": "2024-04-20T12:08:06",
            "upload_time_iso_8601": "2024-04-20T12:08:06.129766Z",
            "url": "https://files.pythonhosted.org/packages/d8/a7/9329439a648477b5687a9ee6a3b645c0c2340aeeb370c7d11556758dc672/django_icons-24.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed202b7af5c94257419c2992608e9ab1d7503a8a5869bae178d5901c76e4c7a5",
                "md5": "ca216a0c2f10406c146b759d37c16f7b",
                "sha256": "2f817b020c2ac4d369d3ca1608b48606e2aeb55f34638e19c346d4146a03ab51"
            },
            "downloads": -1,
            "filename": "django_icons-24.3.tar.gz",
            "has_sig": false,
            "md5_digest": "ca216a0c2f10406c146b759d37c16f7b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 30483,
            "upload_time": "2024-04-20T12:08:07",
            "upload_time_iso_8601": "2024-04-20T12:08:07.647482Z",
            "url": "https://files.pythonhosted.org/packages/ed/20/2b7af5c94257419c2992608e9ab1d7503a8a5869bae178d5901c76e4c7a5/django_icons-24.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-20 12:08:07",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zostera",
    "github_project": "django-icons",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "django-icons"
}
        
Elapsed time: 0.24565s