Forked from
KIF / AKPlanning
479 commits behind the upstream repository.
-
Benjamin Hättasch authored
Introduce model Introduce admin interface Show buttons on dashboard start page
Benjamin Hättasch authoredIntroduce model Introduce admin interface Show buttons on dashboard start page
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
models.py 1.27 KiB
from django.db import models
from django.utils.translation import gettext_lazy as _
from fontawesome_5.fields import IconField
from AKModel.models import Event
class DashboardButton(models.Model):
class Meta:
verbose_name = _("Dashboard Button")
verbose_name_plural = _("Dashboard Buttons")
COLOR_CHOICES = (
(0, "primary"),
(1, "success"),
(2, "info"),
(3, "warning"),
(4, "danger"),
)
text = models.CharField(max_length=50, blank=False, verbose_name=_("Text"),
help_text=_("Text that will be shown on the button"))
url = models.URLField(blank=False, verbose_name=_("Link URL"), help_text=_("URL this button links to"))
icon = IconField(default="external-link-alt", verbose_name=_("Icon"), help_text="Symbol represeting this button.")
color = models.PositiveSmallIntegerField(choices=COLOR_CHOICES, default=0, blank=False,
verbose_name=_("Button Style"), help_text=_("Style (Color) of this button (bootstrap class)"))
event = models.ForeignKey(to=Event, on_delete=models.CASCADE, blank=False, null=False,
verbose_name=_("Event"), help_text=_("Event this button belongs to"))
def __str__(self):
return f"{self.text} ({self.event})"