Just use a simple icon field
The library has some issues, even if it is great https://github.com/saschaludwig/django-fontawesome-6/pull/2
This commit is contained in:
parent
7026aca934
commit
611e343564
8 changed files with 23 additions and 14 deletions
|
@ -23,7 +23,6 @@ sentry-sdk
|
||||||
wagtail-favicon
|
wagtail-favicon
|
||||||
django-sri
|
django-sri
|
||||||
wagtail-2fa
|
wagtail-2fa
|
||||||
django-fontawesome-6
|
|
||||||
|
|
||||||
# Pinned due to lack of Wagtail 3 support
|
# Pinned due to lack of Wagtail 3 support
|
||||||
git+https://github.com/wagtail/wagtail-autocomplete@03f46a0c256989690d0a43fc21fe0f37f9ede765
|
git+https://github.com/wagtail/wagtail-autocomplete@03f46a0c256989690d0a43fc21fe0f37f9ede765
|
||||||
|
|
|
@ -15,10 +15,9 @@ click==8.1.3 # via rq
|
||||||
coreapi==2.3.3 # via drf-yasg
|
coreapi==2.3.3 # via drf-yasg
|
||||||
coreschema==0.0.4 # via coreapi, drf-yasg
|
coreschema==0.0.4 # via coreapi, drf-yasg
|
||||||
deprecated==1.2.13 # via redis
|
deprecated==1.2.13 # via redis
|
||||||
django==4.0.6 # via -r requirements/base.in, django-filter, django-fontawesome-6, django-htmx, django-modelcluster, django-otp, django-permissionedforms, django-plausible, django-redis, django-rq, django-sri, django-taggit, django-treebeard, djangorestframework, drf-yasg, wagtail, wagtail-2fa
|
django==4.0.6 # via -r requirements/base.in, django-filter, django-htmx, django-modelcluster, django-otp, django-permissionedforms, django-plausible, django-redis, django-rq, django-sri, django-taggit, django-treebeard, djangorestframework, drf-yasg, wagtail, wagtail-2fa
|
||||||
django-environ==0.9.0 # via -r requirements/base.in
|
django-environ==0.9.0 # via -r requirements/base.in
|
||||||
django-filter==21.1 # via wagtail
|
django-filter==21.1 # via wagtail
|
||||||
django-fontawesome-6==1.0.0.0 # via -r requirements/base.in
|
|
||||||
django-htmx==1.12.1 # via -r requirements/base.in
|
django-htmx==1.12.1 # via -r requirements/base.in
|
||||||
django-modelcluster==6.0 # via wagtail
|
django-modelcluster==6.0 # via wagtail
|
||||||
django-otp==1.1.3 # via wagtail-2fa
|
django-otp==1.1.3 # via wagtail-2fa
|
||||||
|
|
|
@ -20,12 +20,11 @@ coreschema==0.0.4 # via -r requirements/base.txt, coreapi, drf-yasg
|
||||||
coverage==6.4.4 # via -r requirements/dev.in
|
coverage==6.4.4 # via -r requirements/dev.in
|
||||||
curlylint==0.13.1 # via -r requirements/dev.in
|
curlylint==0.13.1 # via -r requirements/dev.in
|
||||||
deprecated==1.2.13 # via -r requirements/base.txt, redis
|
deprecated==1.2.13 # via -r requirements/base.txt, redis
|
||||||
django==4.0.6 # via -r requirements/base.txt, django-browser-reload, django-debug-toolbar, django-filter, django-fontawesome-6, django-htmx, django-modelcluster, django-otp, django-permissionedforms, django-plausible, django-redis, django-rq, django-sri, django-taggit, django-treebeard, djangorestframework, drf-yasg, wagtail, wagtail-2fa
|
django==4.0.6 # via -r requirements/base.txt, django-browser-reload, django-debug-toolbar, django-filter, django-htmx, django-modelcluster, django-otp, django-permissionedforms, django-plausible, django-redis, django-rq, django-sri, django-taggit, django-treebeard, djangorestframework, drf-yasg, wagtail, wagtail-2fa
|
||||||
django-browser-reload==1.6.0 # via -r requirements/dev.in
|
django-browser-reload==1.6.0 # via -r requirements/dev.in
|
||||||
django-debug-toolbar==3.5.0 # via -r requirements/dev.in
|
django-debug-toolbar==3.5.0 # via -r requirements/dev.in
|
||||||
django-environ==0.9.0 # via -r requirements/base.txt
|
django-environ==0.9.0 # via -r requirements/base.txt
|
||||||
django-filter==21.1 # via -r requirements/base.txt, wagtail
|
django-filter==21.1 # via -r requirements/base.txt, wagtail
|
||||||
django-fontawesome-6==1.0.0.0 # via -r requirements/base.txt
|
|
||||||
django-htmx==1.12.1 # via -r requirements/base.txt
|
django-htmx==1.12.1 # via -r requirements/base.txt
|
||||||
django-modelcluster==6.0 # via -r requirements/base.txt, wagtail
|
django-modelcluster==6.0 # via -r requirements/base.txt, wagtail
|
||||||
django-otp==1.1.3 # via -r requirements/base.txt, wagtail-2fa
|
django-otp==1.1.3 # via -r requirements/base.txt, wagtail-2fa
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
{% if online_accounts %}
|
{% if online_accounts %}
|
||||||
<p class="is-size-3">
|
<p class="is-size-3">
|
||||||
{% for online_account in online_accounts %}
|
{% for online_account in online_accounts %}
|
||||||
<a href="{{ online_account.url }}" title="{{ online_account.name }}">{{ online_account.icon.as_html }}</a>
|
<a href="{{ online_account.url }}" title="{{ online_account.name }}"><i class="{{ online_account.icon }}"></i></a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Generated by Django 4.0.6 on 2022-09-02 07:38
|
# Generated by Django 4.0.6 on 2022-09-02 14:17
|
||||||
|
|
||||||
import fontawesome_6.fields
|
import django.core.validators
|
||||||
from django.db import migrations
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
@ -14,6 +14,10 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name="onlineaccount",
|
model_name="onlineaccount",
|
||||||
name="icon",
|
name="icon",
|
||||||
field=fontawesome_6.fields.IconField(blank=True, max_length=60),
|
field=models.CharField(
|
||||||
|
blank=True,
|
||||||
|
max_length=64,
|
||||||
|
validators=[django.core.validators.RegexValidator("[a-z-\\\\s]")],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
from django.core.validators import RegexValidator
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.http.request import HttpRequest
|
from django.http.request import HttpRequest
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.text import slugify
|
from django.utils.text import slugify
|
||||||
from fontawesome_6.fields import IconField
|
|
||||||
from wagtail.admin.panels import FieldPanel
|
from wagtail.admin.panels import FieldPanel
|
||||||
from wagtail.search import index
|
from wagtail.search import index
|
||||||
from wagtail.snippets.models import register_snippet
|
from wagtail.snippets.models import register_snippet
|
||||||
|
@ -16,7 +16,9 @@ class OnlineAccount(models.Model, index.Indexed):
|
||||||
name = models.CharField(max_length=64, unique=True)
|
name = models.CharField(max_length=64, unique=True)
|
||||||
url = models.URLField()
|
url = models.URLField()
|
||||||
username = models.CharField(max_length=64)
|
username = models.CharField(max_length=64)
|
||||||
icon = IconField()
|
icon = models.CharField(
|
||||||
|
max_length=64, blank=True, validators=[RegexValidator(r"[a-z-\\s]")]
|
||||||
|
)
|
||||||
|
|
||||||
panels = [
|
panels = [
|
||||||
FieldPanel("name"),
|
FieldPanel("name"),
|
||||||
|
|
|
@ -7,7 +7,14 @@
|
||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<div class="media">
|
<div class="media">
|
||||||
<div class="media-content">
|
<div class="media-content">
|
||||||
<p class="title is-4"><a href="{{ account.url }}">{{ account.icon.as_html }} {{ account.name }}</a></p>
|
<p class="title is-4">
|
||||||
|
<a href="{{ account.url }}">
|
||||||
|
{% if account.icon %}
|
||||||
|
<i class="{{ account.icon }}"></i>
|
||||||
|
{% endif %}
|
||||||
|
{{ account.name }}
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
<p class="subtitle is-6">{{ account.username }}</p>
|
<p class="subtitle is-6">{{ account.username }}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -72,7 +72,6 @@ INSTALLED_APPS = [
|
||||||
"wagtail_2fa",
|
"wagtail_2fa",
|
||||||
"django_otp",
|
"django_otp",
|
||||||
"django_otp.plugins.otp_totp",
|
"django_otp.plugins.otp_totp",
|
||||||
"fontawesome_6",
|
|
||||||
"django.contrib.auth",
|
"django.contrib.auth",
|
||||||
"django.contrib.contenttypes",
|
"django.contrib.contenttypes",
|
||||||
"django.contrib.sessions",
|
"django.contrib.sessions",
|
||||||
|
|
Loading…
Reference in a new issue