Add FontAwesome icons to StreamField.
Project description
Add FontAwesome icons to StreamField.
Install
pip install wagtailfontawesome
Then add wagtailfontawesome to your installed apps.
Usage
StreamField
Add FontAwesome icons to StreamField the regular way, just set icon=”fa-something”. Reference the full list.
wagtailmodeladmin
wagtailmodeladmin is supported if you’re using Wagtail 1.4 or above. Similar to StreamField, just set icon=”fa-something” on your menu item.
Hallo plugins
You can use FontAwesome icons on custom Hallo buttons by setting the icon option to icon icon-fa-something.
button.hallobutton({
label: "Blockquote",
icon: 'icon icon-fa-quote-left',
});
Other parts of the admin
You can include icons anywhere in the admin with:
<i class="icon icon-fa-something"></i>
In Wagtail 1.3.x and below you can only use icons on the page editor screen.
On the front-end
You can also include the CSS on the front end, and follow FontAwesome’s documentation.
{% load wagtailfontawesome %}
{% fontawesome_css %}
This will generate equivalent markup to:
<link rel="stylesheet" href="{% static 'wagtailfontawesome/css/fontawesome.css' %}">
Then include icons anywhere on the front-end with:
<i class="fa fa-something"></i>
Using wagtailfontawesome as an optional dependency
If you want to distribute a Wagtail plugin with FontAwesome icons, you can use this package as an optional dependency by checking if it’s installed in Django, and falling back otherwise.
from django.apps import apps
from wagtail.wagtailcore.blocks import StructBlock
class BlockquoteBlock(StructBlock):
quote = TextBlock()
author = TextBlock()
class Meta:
if apps.is_installed('wagtailfontawesome'):
icon = 'fa-quote-left'
(in this case, the fallback is to do nothing)
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
File details
Details for the file wagtailfontawesome-1.1.1.tar.gz
.
File metadata
- Download URL: wagtailfontawesome-1.1.1.tar.gz
- Upload date:
- Size: 653.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04aecfd832ef468469b52408335f979d97c13ddc59682c05b1f8587b7580b375 |
|
MD5 | a396d0775ca8eae185fd83d43afdf8c7 |
|
BLAKE2b-256 | b845bc2cacc434c579d8dfb80a829d330ca83b97269efc12cbccd80832b86b3a |
File details
Details for the file wagtailfontawesome-1.1.1-py2.py3-none-any.whl
.
File metadata
- Download URL: wagtailfontawesome-1.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 655.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b85e397b73c8f08a7a894d36d3f2f663876c8741e6b86fb5df737181a544654e |
|
MD5 | 247714ce1465fa1090e83b1dca7712b5 |
|
BLAKE2b-256 | 21268eb7e993af8878672c0bfab71e52e3abe69dc3b0c500785c2fa2efb656de |