A utility for using icons in models and forms.
Project description
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.)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-font-icons-1.0.1.tar.gz.
File metadata
- Download URL: django-font-icons-1.0.1.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68c3ac2d4e44c7245bd6125fd42bde3857390011fcc39a8ec73789d216525a63
|
|
| MD5 |
e09df514edb2faf5a7705cfcac003e67
|
|
| BLAKE2b-256 |
42aa5e8f36e022832e69d95260dc8d8929f92b9a626ec9b3880a4cc4211e1dc5
|
File details
Details for the file django_font_icons-1.0.1-py3-none-any.whl.
File metadata
- Download URL: django_font_icons-1.0.1-py3-none-any.whl
- Upload date:
- Size: 17.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc9d26d504f068bdbedd058586a7661e4ad5dbbf737b4cb39012d9fcea17c1fe
|
|
| MD5 |
9c9b4a19deadb48907d27b63682d2e64
|
|
| BLAKE2b-256 |
f0083112a1036eebf40c63f3aebe4596eb4e5242b09c6c40e288d05db7ad32cf
|