django-font-icons
A utility for using icons in models and forms. You can also disable icons so they will no show in the select.
It uses selectr for filtering of the icons.
Installation / Usage
pip install django-font-icons
Add 'font_icons' to your installed INSTALLED_APPS:
INSTALLED_APPS = (
...
'font_icons',
)
Import and use IconForeignKeyField:
from font_icons.models import IconForeignKeyField
class Category(models.Model):
...
icon = IconForeignKeyField()
Add Fontawesome js and/or css yourself. We do not provide a default version.
admin/base_site.html
{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link href="https://unpkg.com/mobius1-selectr@latest/dist/selectr.min.css" rel="stylesheet" type="text/css">
<script src="https://unpkg.com/mobius1-selectr@latest/dist/selectr.min.js" type="text/javascript"></script>
{% endblock %}
Rendering
You can do a simple render in your template like this:
{% for category in categories.all %}
{% if category.icon %}
{{ category.icon.as_html }}
{% endif %}
{% endfor %}
Changes
- Add the fontawesome 5 Free icons. (
manage.py loadfontawesome5_free) - Support for fontawesome 5 Pro and fontawesome 4.7 (No management command to load all the icons yet.)
Metadata
Release files for django-font-icons 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-font-icons-1.0.1.tar.gz | 14.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_font_icons-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.9 kB
Release files / django-font-icons-1.0.1.tar.gz
| Download URL | django-font-icons-1.0.1.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68c3ac2d4e44c7245bd6125fd42bde3857390011fcc39a8ec73789d216525a63
|
|
BLAKE2b-256 checksum How to use checksums |
42aa5e8f36e022832e69d95260dc8d8929f92b9a626ec9b3880a4cc4211e1dc5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|
Release files / django_font_icons-1.0.1-py3-none-any.whl
| Download URL | django_font_icons-1.0.1-py3-none-any.whl |
|---|---|
| Size | 17.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc9d26d504f068bdbedd058586a7661e4ad5dbbf737b4cb39012d9fcea17c1fe
|
|
BLAKE2b-256 checksum How to use checksums |
f0083112a1036eebf40c63f3aebe4596eb4e5242b09c6c40e288d05db7ad32cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8
|