Skip to main content

Icons for Django

Project description


CI Coverage Status Latest PyPI version

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


Install using pip.

pip install django-icons

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

    # ...
    # ...

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

Render an icon in a Django template.

{% load icons %}

<!-- Include your icon library. This example uses Font Awesome 6 through cdnjs.  -->
<link rel="stylesheet" href="">

{% icon 'edit' %}

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

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

Add extra classes and attributes to your predefined icon.

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

These will be added to the HTML output.

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


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

See "Supported Versions" on

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:

$ git clone git://
$ cd django-icons
$ pip install -e .
$ pip install -U pip -r requirements-dev.txt

Running the demo

You can run the example app:

cd example && run python runserver

Running the tests

The test suite requires tox to be installed. Run the complete test suite like this:


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

python test


Our plans at Zostera for an icon tool originate in We isolated this into a Font Awesome tool in 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.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_icons-24.2.tar.gz (32.5 kB view hashes)

Uploaded Source

Built Distribution

django_icons-24.2-py3-none-any.whl (13.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page