Skip to content
Snippets Groups Projects
Select Git revision
  • 8e674cbe17faafcf52109ef65961a513b767f5f7
  • main default protected
  • feature/export-filtering
  • feature/clear-schedule-button
  • fix/responsive-cols-in-polls
  • feature/preference-polling-form
  • feature/json-export-via-rest-framework
  • feature/json-schedule-import-tests
  • fix/add-room-import-only-once
  • ak-import
  • renovate/django-simple-history-3.x
  • renovate/django-debug-toolbar-4.x
  • renovate/django-5.x
  • renovate/mysqlclient-2.x
14 results

models.py

Blame
  • Forked from KIF / AKPlanning
    Source project has a limited visibility.
    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})"