Skip to main content

Django Feather

A simple Tag ({% icon "name" %}) to implement Feather Icons in Django.

Install

Install django-feather using pip and put it into your INSTALLED_APPS:

pip install django-feather

settings.py:

INSTALLED_APPS = [
    # ...
    'django_feather',
    # ...
]

Usage

After installation, the tag can be used just like any other tag:

{% load icon %}

<p>Using a string {% icon "coffee" class="css-class" height="8" width="8" %}</p>
<p>Using a variable {% icon self.icon class="css-class" height="8" width="8" %}</p>

The icon tag will simply take the SVG source from the Feather project, apply additional attributes and return the SVG tag.

Testing

There are a few tests in the tests directory that should test the basic functions of this module. However, as these tests require the package to be build (so that the django_feather.icons module is populated), there are a few important steps to testing:

# Start by building the project
python setup.py build
# There should now be a build/lib directory present

# Make sure that django, pytest and pytest-django are installed:
pip install django pytest pytest-django

# Run the tests
export DJANGO_SETTINGS_MODULE=tests.settings
PYTHONPATH=build/lib:./ pytest tests 

The environment variable PYTHONPATH ensures that django_feather is not imported from the current directory but rather from the build/lib directory.

Performance

django-feather does not read the .svg files each time an icon is rendered. Instead, all the icons are written to a .py file upon build, just like the JavaScript library.
However, other than the JavaScript library, icons are rendered on the server side. This avoids having to call feather.replace() after the page has loaded.

License

Feather is licensed under the MIT License.

django-feather is licensed under the Apache License, Version 2.0:

Copyright 2019-2021 Jonas Drotleff <j.drotleff@desk-lab.de>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Release files for django-feather 0.3.0

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

Source distribution (sdist)

Source distribution for django-feather 0.3.0
File Size Uploaded
django-feather-0.3.0.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-feather 0.3.0
File Interpreter ABI Platform
django_feather-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.9 kB

Release files / django-feather-0.3.0.tar.gz

Download URL django-feather-0.3.0.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ed60fbaed605ee6912a36a7be442d7150e2d48cc46bb40a8d9fc2da162b9c676
BLAKE2b-256 checksum
How to use checksums
bd504393350d58e5c527bb34096e6f6c4d14c2ff61c23375c01506721de59f53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release files / django_feather-0.3.0-py3-none-any.whl

Download URL django_feather-0.3.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc3dcd9f42fa449d947130b31c154df14275edfd2e48909f5ea7f0ec7634badd
BLAKE2b-256 checksum
How to use checksums
d5d05431b614bf6cb801976217f61d8ff982daa33a5c8ac2bbcead5097ed79f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.1.2

2 release files

0.1

2 release files

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