django-icons


Namedjango-icons JSON
Version 25.2 PyPI version JSON
download
home_pageNone
SummaryIcons for Django
upload_time2025-07-31 09:16:50
maintainerNone
docs_urlNone
authorDylan Verheul
requires_python>=3.9
licenseNone
keywords django icons
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-icons

[![Tests](https://github.com/zostera/django-icons/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/zostera/django-icons/actions?query=workflow%3Atest+branch%3Amain)
[![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

### Local installation

This package uses [uv](https://github.com/astral-sh/uv) and [just](https://github.com/casey/just).

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

```console
git clone git://github.com/zostera/django-icons.git
cd django-icons
just bootstrap
```

### Running the demo

You can run the example app:

```shell
just example
```

### 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
just 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.9",
    "maintainer_email": null,
    "keywords": "django, icons",
    "author": "Dylan Verheul",
    "author_email": "Dylan Verheul <dylan@dyve.net>",
    "download_url": "https://files.pythonhosted.org/packages/c5/21/0e1a4a35f7c543653449defe4ed9217b7aa0b4f1dcce948f7a044612c45b/django_icons-25.2.tar.gz",
    "platform": null,
    "description": "# django-icons\n\n[![Tests](https://github.com/zostera/django-icons/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/zostera/django-icons/actions?query=workflow%3Atest+branch%3Amain)\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### Local installation\n\nThis package uses [uv](https://github.com/astral-sh/uv) and [just](https://github.com/casey/just).\n\nTo clone the repository and install the requirements for local development:\n\n```console\ngit clone git://github.com/zostera/django-icons.git\ncd django-icons\njust bootstrap\n```\n\n### Running the demo\n\nYou can run the example app:\n\n```shell\njust example\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\njust 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": null,
    "summary": "Icons for Django",
    "version": "25.2",
    "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": null,
            "digests": {
                "blake2b_256": "36345a282c93fdffff5e2bdf52241a30035b65d4092e46e69e9088116e501aac",
                "md5": "8c1121926a1012ae41b91f0098e463f9",
                "sha256": "775c8ee786ae934233efe6b0aeba17ae6e243c7906ef4dd774d5fa3cae644798"
            },
            "downloads": -1,
            "filename": "django_icons-25.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8c1121926a1012ae41b91f0098e463f9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 13291,
            "upload_time": "2025-07-31T09:16:48",
            "upload_time_iso_8601": "2025-07-31T09:16:48.842724Z",
            "url": "https://files.pythonhosted.org/packages/36/34/5a282c93fdffff5e2bdf52241a30035b65d4092e46e69e9088116e501aac/django_icons-25.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "c5210e1a4a35f7c543653449defe4ed9217b7aa0b4f1dcce948f7a044612c45b",
                "md5": "a261ec760da310dfeca64f1fb3e9bdad",
                "sha256": "c82e0b1fe02b40030c729d11fa114738b18ec6248f2291f6e9de80a2aaf5aac1"
            },
            "downloads": -1,
            "filename": "django_icons-25.2.tar.gz",
            "has_sig": false,
            "md5_digest": "a261ec760da310dfeca64f1fb3e9bdad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 96219,
            "upload_time": "2025-07-31T09:16:50",
            "upload_time_iso_8601": "2025-07-31T09:16:50.302553Z",
            "url": "https://files.pythonhosted.org/packages/c5/21/0e1a4a35f7c543653449defe4ed9217b7aa0b4f1dcce948f7a044612c45b/django_icons-25.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-31 09:16:50",
    "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: 1.81943s