Skip to main content

pypi coverage python django djangocms djangocms4

django CMS Icon is a plugin for django CMS that allows you to insert an icon (font or svg) into your project.

preview.gif

Contribute to this project and win rewards

Because this is a an open-source project, we welcome everyone to get involved in the project and receive a reward for their contribution. Become part of a fantastic community and help us make django CMS the best CMS in the world.

We’ll be delighted to receive your feedback in the form of issues and pull requests. Before submitting your pull request, please review our contribution guidelines.

We’re grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

Installation

For a manual install:

  • run pip install djangocms-icon

  • add djangocms_icon to your INSTALLED_APPS

  • run python manage.py migrate djangocms_icon

A note about django CMS Text CKEditor

There are additional steps required for the icon plugin to display correctly inside CKEditor.

1. You need to make sure your icon CSS is passed via CKEditors contentsCss parameter. On Divio Cloud this can be done through the Addons configuration.

2. CKEditor automatically removes empty tags, you can prevent this by adding a javascript configuration file to style_set.

django CMS Icon does not add the styles or javascript files to your frontend, these need to be added at your discretion.

Configuration

This addon provides a default template for all instances. You can provide additional template choices by adding a DJANGOCMS_ICON_TEMPLATES setting:

DJANGOCMS_ICON_TEMPLATES = [
    ('svg', 'SVG template'),
]

Web Font Icons

The django CMS Icon plugin ships with Font Awesome 5 as default. This can be changed by overriding the following setting:

DJANGOCMS_ICON_SETS = [
    ('fontawesome5regular', 'far', 'Font Awesome 5 Regular', 'lastest'),
    ('fontawesome5solid', 'fas', 'Font Awesome 5 Solid', 'lastest'),
    ('fontawesome5brands', 'fab', 'Font Awesome 5 Brands', 'lastest'),
]

In addition you need to load the resources for your fonts in /admin/djangocms_icon/includes/assets.html. Add this file to your project in order for the icon picker to pick up your custom icons in the admin.

The icon picker supports numerous font libraries out of the box. You can also add multiple font sets like this:

DJANGOCMS_ICON_SETS = [
    ('elusiveicon', 'el', 'Elusive Icons'),
    ('flagicon', 'flag-icon', 'Flag Icons'),
    ('fontawesome5regular', 'far', 'Font Awesome 5 Regular'),
    ('fontawesome5solid', 'fas', 'Font Awesome 5 Solid'),
    ('fontawesome5brands', 'fab', 'Font Awesome 5 Brands'),
    ('fontawesome5light', 'fal', 'Font Awesome 5 Light', '5.3.1_pro'),
    ('glyphicon', 'glyphicon', 'Glyphicons'),
    ('ionicon', 'ion', 'Ionicons Icons'),
    ('mapicon', 'map-icon', 'Map Icons'),
    ('materialdesign', 'zmdi', 'Material Design'),
    ('octicon', 'octicon', 'Octicons'),
    ('typicon', 'typcn', 'Typicons'),
    ('weathericon', 'wi', 'Weather Icons'),
]

You can also add the version number as a fourth parameter. If no parameter is given the latest version of the bootstrap-iconpicker icon set is used.:

DJANGOCMS_ICON_SETS = [
    ('fontawesome4', 'fa', 'Font Awesome 4', '4.0.0'),
    ('fontawesome5light', 'fal', 'Font Awesome 5 Light', '5.3.1_pro'),
]

Just don’t forget to include both libraries in the assets.html file. This is only necessary for the plugin rendering while selecting the icon. You still need to implement the font libraries into your frontend stack.

Custom Web Font Icons

You can also add your own custom web fonts, for this you need to tell the icon picker where to find the necessary files:

DJANGOCMS_ICON_SETS = [
    (ICONSET, 'icon', 'Custom web font'),
]

In this example, we add our own font icon set on top of it. Please mind that the second parameter needs to be the icon prefix. ICONSET is an external reference to a JSON file at the root of your project setting up your custom font icons, add this before:

with open('iconset.json') as fh:
    ICONSET = fh.read()

Here an example of its content:

{
    "iconClass": "icon",
    "icons": [
        "icon-icon1",
        "icon-icon2",
        "..."
    ]
}

The iconClass refers to the second parameter in the settings file for the icon prefix. Make sure both of them are the same. Instead of using an external file you can also write the settings directly to the DJANGOCMS_ICON_SETS setting.

djangocms-boilerplate-webpack can generate the iconset.json automatically for you through gulp icons.

Make sure the icons names contain the iconset prefix as shown in the example, the widget will determine the iconset based on that. They can be omitted if only one iconset is used.

Don’t forget to also add your custom fonts to /admin/djangocms_icon/includes/assets.html into your project.

SVG Icons

django CMS Icon also supports SVG icons. Follow the instructions from Custom Web Font Icons and then adapt the JSON file a bit:

{
    "svg": true,
    "spritePath": "sprites/icons.svg",
    "iconClass": "icon",
    "icons": [
        "icon-icon1",
        "icon-icon2",
        "..."
    ]
}

svg and spritePath are the only required additional properties. You also need to add an icon template to your project to render it correctly, for example:

<span class="{{ instance.icon }} {{ instance.attributes.class }}">
    <svg role="presentation">
        <use xlink:href="{% static 'sprites/icons.svg' %}#{{ instance.icon }}"></use>
    </svg>
</span>

Running Tests

You can run tests by executing:

virtualenv env
source env/bin/activate
pip install -r tests/requirements.txt
python setup.py test

Release files for djangocms-icon 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djangocms-icon 2.1.1
File Size Uploaded
djangocms_icon-2.1.1.tar.gz 146.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djangocms-icon 2.1.1
File Interpreter ABI Platform
djangocms_icon-2.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 310.8 kB

Release files / djangocms_icon-2.1.1.tar.gz

Download URL djangocms_icon-2.1.1.tar.gz
Size 146.5 kB
Tags Source
SHA-256 checksum
How to use checksums
77f7b4c697d652077113203049b54c32c27cf2d05cc45e7275520d1762569ad3
BLAKE2b-256 checksum
How to use checksums
3b658ff3aef0fde78b4bf21fbc33b179a725e492c94cea6a04ddd7316a082d64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2025.

Transparency log

Release files / djangocms_icon-2.1.1-py3-none-any.whl

Download URL djangocms_icon-2.1.1-py3-none-any.whl
Size 164.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fda9d3c9e262dbfbecc93b668cb40c02185c8645d858423b21d116f7ed4f606e
BLAKE2b-256 checksum
How to use checksums
6a39521c35cda03436507a2fbe31382b5b98fd0adc858b9df340ea05346c9e31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 29, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

2.1.1 This release

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.5.0

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.0

1 release file

1.1.0

2 release files

1.0.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page