Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
django-fontawesome-6
Advanced tools
This is a fork of https://github.com/BenjjinF/django-fontawesome-5 and I made some minor changes so this is compatible with my Django 4 Projects and makes use of Fontawesome 6.0.0
I consider renaming this to django-fontawesome-6 in the near future and to provide a new python module.
This is a best-effort fork, I try to keep it up-to-date but can't promise any further development.
A utility for using icons in models, forms, and templates and supports Django 4.0.
pipenv install django-fontawesome-6
Add 'fontawesome_6' to your installed INSTALLED_APPS
:
INSTALLED_APPS = (
...
'fontawesome_6',
)
Import and use IconField
:
from fontawesome_6.fields import IconField
class Category(models.Model):
...
icon = IconField()
Include Static Files
{% load fontawesome_6 %}
<head>
{% fontawesome_6_static %}
...
</head>
You can configure django-fontawesome to use another release/source/cdn by specifying::
FONTAWESOME_6_CSS = URL or None
default: 'fontawesome_6/css/django-fontawesome.css'
FONTAWESOME_6_CSS_ADMIN = URL or path
default: None
FONTAWESOME_6_ICON_CLASS = 'default' or 'semantic_ui'
default: 'default'
FONTAWESOME_6_PREFIX = 'custom_prefix'
default: 'fa'
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 %}
Or you can use the {% fa6_icon %}
template tag.
{% fa6_icon 'github' 'fab' %}
Positional arguments: icon
(required), style_prefix
(default: 'fas')
extra custom classes
CSS Color Names
boolean
boolean
horizontal
vertical
boolean
left
right
boolean
integer
fa-xs
fa-sm
fa-lg
fa-2x
fa-3x
fa-5x
fa-7x
fa-10x
boolean
string
Or you can use the {% fa6_icon %}
template tag.
{% fa6_icon 'check' %}
Required positional arguments: icon
extra custom classes
boolean
boolean
Semantic UI Colors
boolean
boolean
horizontal
vertical
boolean
boolean
boolean
clockwise
counterclockwise
boolean
integer
fa-xs
fa-sm
fa-lg
fa-2x
fa-3x
fa-5x
fa-7x
fa-10x
string
Credit to https://github.com/redouane for the original
Also credit to https://github.com/BenjjinF for the django-fontawesome-5 version
FAQs
A utility for using icons in models, forms, and templates.
We found that django-fontawesome-6 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.