django-fontawesome-5
A utility for using icons in models, forms, and templates. Does support Django 3.0, which django-fontawesome will not.
Migration guide from django-fontawesome
- Remove all occurences of {% fontawesome_stylesheet %}
- Replace {% load fontawesome %} with {% load fontawesome_5 %}
- Replace '{% fontawesome_icon' with '{% fa5_icon'
- Replace iconnames, for example "bell" needs to be replaced with "bell fas" and "linedin-square" with "linkedin fab"
Installation / Usage
pipenv install django-fontawesome-5
Add 'fontawesome_5' to your installed INSTALLED_APPS:
INSTALLED_APPS = (
...
'fontawesome_5',
)
Import and use IconField:
from fontawesome_5.fields import IconField
class Category(models.Model):
...
icon = IconField()
Include Static Files
{% load fontawesome_5 %}
<head>
{% fontawesome_5_static %}
...
</head>
Settings
You can configure django-fontawesome to use another release/source/cdn by specifying::
FONTAWESOME_5_CSS = URL or None
default: 'fontawesome_5/css/django-fontawesome.css'
FONTAWESOME_5_CSS_ADMIN = URL or path
default: None
FONTAWESOME_5_ICON_CLASS = 'default' or 'semantic_ui'
default: 'default'
FONTAWESOME_5_PREFIX = 'custom_prefix'
default: 'fa'
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 %}
Default Renderer
Or you can use the {% fa5_icon %} template tag.
{% fa5_icon 'github' 'fab' %}
Positional arguments: icon (required), style_prefix (default: 'fas')
Key word arguments:
- class
extra custom classes - color
CSS Color Names - border
boolean - fixed_width
boolean - flip
horizontalvertical
- li
boolean - pull
leftright- pulse
boolean - rotate
integer - size
fa-xsfa-smfa-lgfa-2xfa-3xfa-5xfa-7xfa-10x
- spin
boolean - title
string
Semantic UI Renderer
Or you can use the {% fa5_icon %} template tag.
{% fa5_icon 'check' %}
Required positional arguments: icon
Key word arguments:
- class
extra custom classes - bordered
boolean - circular
boolean - colored
Semantic UI Colors - disabled
boolean - fitted
boolean - flipped
horizontalvertical
- inverted
boolean - link
boolean - loading
boolean - rotated
clockwisecounterclockwise- pulse
boolean - rotate
integer - size
fa-xsfa-smfa-lgfa-2xfa-3xfa-5xfa-7xfa-10x
- title
string
Credit
Credit to https://github.com/redouane for the original ~
Changes
- Updated for use with Font Awesome 5
- Removed PyYAML, Select2, and jQuery as dependencies
- Static files tag includes static dependencies for use outside admin
- Moved rendering logic to renderers
Metadata
Release files for django-fontawesome-5 1.0.18
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-fontawesome-5-1.0.18.tar.gz | 2.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_fontawesome_5-1.0.18-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.1 MB
Release files / django-fontawesome-5-1.0.18.tar.gz
| Download URL | django-fontawesome-5-1.0.18.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4fc4a7f5d0fe6e10d542ac9f1c143ad5e92aa61c6f310ea297c3c26bfc6001dd
|
|
BLAKE2b-256 checksum How to use checksums |
dc4b5f89bb9bbde06838707598401fdc73dbe39b61526b63c09755c3be16827a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|
Release files / django_fontawesome_5-1.0.18-py3-none-any.whl
| Download URL | django_fontawesome_5-1.0.18-py3-none-any.whl |
|---|---|
| Size | 2.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1be340e795a6a68ebd9ba5d75e26bd72a839515c351786ff45e16b90bf50c3a0
|
|
BLAKE2b-256 checksum How to use checksums |
bf2963f9ae346c8922de2a9ffaf4bd856af9523c06ef1275801a3a5198a57744
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|