From 59bb831735be5af234a6d7489447314fddec8484 Mon Sep 17 00:00:00 2001 From: Anders Bruun Severinsen <202204885@post.au.dk> Date: Fri, 13 Dec 2024 20:30:41 +0100 Subject: [PATCH] Add current week filter and pagination to bartender shifts --- ...6_alter_boardmemberdepositshift_options.py | 17 +++ bartenders/models.py | 19 +++- bartenders/templates/barplan.html | 87 ++++++++++++--- bartenders/views.py | 30 +++--- locale/da/LC_MESSAGES/django.mo | Bin 3982 -> 3787 bytes locale/da/LC_MESSAGES/django.po | 99 ++++++++++-------- locale/en/LC_MESSAGES/django.mo | Bin 25135 -> 25230 bytes locale/en/LC_MESSAGES/django.po | 54 +++++----- web/static/css/stylesheet.css | 38 +++++++ web/templatetags/is_current_week.py | 13 +++ 10 files changed, 255 insertions(+), 102 deletions(-) create mode 100644 bartenders/migrations/0006_alter_boardmemberdepositshift_options.py create mode 100644 web/templatetags/is_current_week.py diff --git a/bartenders/migrations/0006_alter_boardmemberdepositshift_options.py b/bartenders/migrations/0006_alter_boardmemberdepositshift_options.py new file mode 100644 index 0000000..b66bb0d --- /dev/null +++ b/bartenders/migrations/0006_alter_boardmemberdepositshift_options.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.4 on 2024-12-13 19:30 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("bartenders", "0005_auto_20241212_2345"), + ] + + operations = [ + migrations.AlterModelOptions( + name="boardmemberdepositshift", + options={"ordering": ("-start_date",)}, + ), + ] diff --git a/bartenders/models.py b/bartenders/models.py index 630d59a..ef4566b 100644 --- a/bartenders/models.py +++ b/bartenders/models.py @@ -103,15 +103,15 @@ def symbol(self): @property def first_bartender_shift(self): - return BartenderShift.with_bartender(self).first() + return BartenderShift.with_bartender(self).last() @property def last_bartender_shift(self): - return BartenderShift.with_bartender(self).last() + return BartenderShift.with_bartender(self).first() @property def first_deposit_shift(self): - return BoardMemberDepositShift.with_bartender(self).first() + return BoardMemberDepositShift.with_bartender(self).last() MAILMAN_ALL = ( settings.MAILMAN_ALL_LIST, @@ -446,6 +446,11 @@ def display_str(self): def is_with_bartender(self, bartender): return bartender in self.all_bartenders() + def is_current_week(self): + return self.start_datetime >= timezone.now() - datetime.timedelta( + days=7 + ) and self.end_datetime <= timezone.now() + datetime.timedelta(days=7) + def replace(self, b1, b2): if self.responsible == b1: self.responsible = b2 @@ -480,7 +485,7 @@ class BoardMemberDepositShift(models.Model): ) class Meta: - ordering = ("start_date",) + ordering = ("-start_date",) def save(self, *args, **kwargs): if not self.end_date: @@ -495,6 +500,12 @@ def with_bartender(cls, bartender): def is_with_bartender(self, bartender): return bartender in self.responsibles.all() + def is_current_week(self): + return ( + timezone.now().date() >= self.start_date + and timezone.now().date() <= self.end_date + ) + def __str__(self): return ( f'{self.start_date}: {", ".join(b.name for b in self.responsibles.all())}' diff --git a/bartenders/templates/barplan.html b/bartenders/templates/barplan.html index b5b7414..81aa9c7 100644 --- a/bartenders/templates/barplan.html +++ b/bartenders/templates/barplan.html @@ -3,16 +3,11 @@ {% block content %} {% load i18n %} {% load static %} -{% load is_with_user %} +{% load bootstrap5 bootstrap_icons %} +{% load is_with_user is_current_week %}

{% translate "Barplan" %}

-{% if show_all %} -{% translate "Vis nuværende" %} -{% else %} -{% translate "Vis også tidligere" %} -{% endif %} - @@ -27,7 +22,7 @@

{% translate "Barplan" %}

{% for shift in bartendershifts %} - +
{{ shift.display_str }} {% if show_all %} {{ shift.start_datetime.year }}{% endif %}{{ shift.display_str }} {% if show_all %} {{ shift.start_datetime.year }}{% endif %} {{ shift.responsible.name }} {% for bartender in shift.other_bartenders.all %} @@ -42,18 +37,46 @@

{% translate "Barplan" %}

+ + iCal feed

{% translate "Pantvagter" %}

-{% if show_all %} -{% translate "Vis nuværende" %} -{% else %} -{% translate "Vis også tidligere" %} -{% endif %} - @@ -66,7 +89,7 @@

{% translate "Pantvagter" %}

{% for shift in boardmemberdepositshifts %} - +
{{ shift.start_date | date:"d M" }}{% if show_all %} {{ shift.start_date.year }}{% endif %} - {{ shift.end_date | date:"d M" }}{% if show_all %} {{ shift.end_date.year }}{% endif %} {% for responsible in shift.responsibles.all %} @@ -82,6 +105,40 @@

{% translate "Pantvagter" %}

+ + iCal feed {% endblock %} diff --git a/bartenders/views.py b/bartenders/views.py index ae633eb..df8f899 100644 --- a/bartenders/views.py +++ b/bartenders/views.py @@ -6,8 +6,9 @@ from django.contrib import messages from django.contrib.admin.views.decorators import staff_member_required from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin +from django.core.paginator import Paginator from django.db import IntegrityError -from django.shortcuts import get_object_or_404, redirect, reverse +from django.shortcuts import get_object_or_404, redirect, render, reverse from django.utils import timezone from django.utils.translation import gettext_lazy as _ from django.views.generic import ( @@ -84,23 +85,26 @@ class Barplan(TemplateView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) + bartendershifts = BartenderShift.objects.all() + depositshifts = BoardMemberDepositShift.objects.all() - show_all = "show_all" in self.request.GET + paginator_bartendershifts = Paginator(bartendershifts, 10) + paginator_depositshifts = Paginator(depositshifts, 10) - context["show_all"] = show_all - - if show_all: - end_datetime = timezone.make_aware(datetime.datetime.utcfromtimestamp(0)) - else: - end_datetime = timezone.now() - datetime.timedelta(1) - - context["bartendershifts"] = BartenderShift.objects.filter( - end_datetime__gte=end_datetime + bartendershifts_page_number = self.request.GET.get("shifts_page") + bartendershifts_page_obj = paginator_bartendershifts.get_page( + bartendershifts_page_number ) - context["boardmemberdepositshifts"] = BoardMemberDepositShift.objects.filter( - end_date__gte=end_datetime + + depositshifts_page_number = self.request.GET.get("deposit_page") + depositshifts_page_obj = paginator_depositshifts.get_page( + depositshifts_page_number ) + context["bartendershifts"] = bartendershifts_page_obj + + context["boardmemberdepositshifts"] = depositshifts_page_obj + return context diff --git a/locale/da/LC_MESSAGES/django.mo b/locale/da/LC_MESSAGES/django.mo index 21b5fd57577e0201fa32b558b7df5dd71a6407fe..b9f0db8de2907f01ccf7fdc0778cd3fae6476dbc 100644 GIT binary patch delta 1242 zcmZ|NPe{{Y9LMp;<w#~|6MTWa9BBMG)L^9kj9m#W}BA%xev9a zcMZQD{*C&(7-Z=`*D>`Iug7gzj&0b4omhvb(1XL)EFK`fikk!Q_CR6&zAzKpcW+_3R&tRJ#*!KG}KXGMB8^@i6f$MsWpIXgRy( zm8QW<|5fRB7PR9qDp411!GoxdoIxe*xA7pV;54d$X?y>njUS_SylmG$A-T;L8~;LW z^pBVRw=i+hUnOY8HVmN>pF^HC1E@1FimLoRsjf6?Hm>ppgOXED&z_BPV*F1=xfv&c#B--BZFG|)y8V8I$O!0Lj9=1 z!l*+S$98NzW+zjqmd>LpTtp>WLUUwfBwyog%n!L&e7zHyjFTP@OgheRVPDw;SM^Y8 ztQd_2E@V>4#8hFmqOv4@I@p_W662}SbTF0}ce(?SP-Jf~90`UynRZ9I+Ct$_$aA7E zc+$zH#{TNUIrZuszV*T1YITy-YRHi z5JI9IIut}B>JkKbv7Mqr(INT+QAE%o!62dcXM2hs{OEp%#Zoose8&+`FN0Gm^v#5rlE^h1#vqPhH;!UGPUBjz$LuaD^G3?R)FP<+9jMYLu-YnAi3`p%c#!oN=I|jl<2NKHTR|PL zj#KIRp%C@o$fTJIsz4WNqh7bpqcS~=+PL8EUvldS)JbRE^(Ux=p1E}eb--7sp1*e2 zS8x|=eQ*0qk4WFmH7f{<3()657>vx?tYqnXyabof;m*r z3#f{o$LjNoOjMF_R3cMIa&{S2iCd_i&mqsYN6zQSkGzDtMnqOVk*B*&UvbXLRe>Q z`tNf)vo2zLiCe{(^S%T;%G*n^@l~R2+E4BN6l-vCC n-jXLgSZb+XD0u>{4cV?tZ)bO=KigN12Rz<#Hu%(gEnN8nXRv6x diff --git a/locale/da/LC_MESSAGES/django.po b/locale/da/LC_MESSAGES/django.po index ffad96d..8dc78f7 100644 --- a/locale/da/LC_MESSAGES/django.po +++ b/locale/da/LC_MESSAGES/django.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-12 23:42+0100\n" -"PO-Revision-Date: 2024-11-04 20:16+0050\n" +"POT-Creation-Date: 2024-12-13 20:27+0100\n" +"PO-Revision-Date: 2024-12-13 20:28+0050\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -71,7 +71,7 @@ msgstr "Saldo" msgid "Total forbrug" msgstr "Total forbrug" -#: bartab/templates/bartab.html:19 bartenders/templates/barplan.html:19 +#: bartab/templates/bartab.html:19 bartenders/templates/barplan.html:14 #: gallery/models.py:101 msgid "Dato" msgstr "Dato" @@ -145,7 +145,7 @@ msgstr "Studie" msgid "Årgang" msgstr "Årgang" -#: bartenders/models.py:245 +#: bartenders/models.py:247 msgid "" "Fortæl lidt om dig selv, og hvorfor du tror at lige præcist du, ville være " "en god bartender" @@ -157,52 +157,50 @@ msgstr "" msgid "Gem" msgstr "Gem" -#: bartenders/templates/barplan.html:8 web/templates/base.html:75 +#: bartenders/templates/barplan.html:9 web/templates/base.html:75 msgid "Barplan" msgstr "Barplan" -#: bartenders/templates/barplan.html:11 bartenders/templates/barplan.html:52 -#: events/templates/events.html:12 -msgid "Vis nuværende" -msgstr "Vis nuværende" - -#: bartenders/templates/barplan.html:13 bartenders/templates/barplan.html:54 -#: events/templates/events.html:14 -msgid "Vis også tidligere" -msgstr "Vis også tidligere" - -#: bartenders/templates/barplan.html:20 +#: bartenders/templates/barplan.html:15 msgid "Ansvarlig" msgstr "Ansvarlig" -#: bartenders/templates/barplan.html:21 bartenders/templates/bartenders.html:6 +#: bartenders/templates/barplan.html:16 bartenders/templates/bartenders.html:6 #: web/templates/base.html:76 msgid "Bartendere" msgstr "Bartendere" -#: bartenders/templates/barplan.html:34 +#: bartenders/templates/barplan.html:25 +msgid "This weeks friday" +msgstr "Denne uges fredag" + +#: bartenders/templates/barplan.html:29 msgid "Bartender's first shift" msgstr "Bartenderens første vagt" -#: bartenders/templates/barplan.html:38 bartenders/templates/barplan.html:78 +#: bartenders/templates/barplan.html:33 bartenders/templates/barplan.html:101 #: bartenders/templates/board.html:34 gallery/templates/gallery.html:24 #: items/templates/items.html:79 msgid "Edit" msgstr "Rediger" -#: bartenders/templates/barplan.html:49 bartenders/views.py:150 +#: bartenders/templates/barplan.html:78 bartenders/views.py:150 msgid "Pantvagter" msgstr "" -#: bartenders/templates/barplan.html:60 +#: bartenders/templates/barplan.html:83 msgid "Uge" msgstr "" -#: bartenders/templates/barplan.html:61 udlejning/models.py:107 +#: bartenders/templates/barplan.html:84 udlejning/models.py:107 msgid "Ansvarlige" msgstr "" -#: bartenders/templates/barplan.html:73 +#: bartenders/templates/barplan.html:92 +msgid "Current week" +msgstr "Nuværende uge" + +#: bartenders/templates/barplan.html:96 msgid "Bartender's first deposit shift" msgstr "Bartenderens første pantvagt" @@ -221,7 +219,8 @@ msgstr "" #: bartenders/templates/bartender_info.html:49 #: bartenders/templates/bartender_info.html:56 msgid "" -"Husk at du som inaktiv bartender ikke kan komme til bartenderarrangementerne." +"Husk at du som inaktiv bartender ikke kan komme til " +"bartenderarrangementerne." msgstr "" #: bartenders/templates/bartender_info.html:49 @@ -343,7 +342,7 @@ msgstr "" msgid "Bartendertilmeldingen er lukket." msgstr "" -#: bartenders/views.py:65 +#: bartenders/views.py:66 msgid "Din ansøgning er blevet indsendt." msgstr "" @@ -397,6 +396,14 @@ msgstr "" msgid "Bartender events" msgstr "" +#: events/templates/events.html:12 +msgid "Vis nuværende" +msgstr "Vis nuværende" + +#: events/templates/events.html:14 +msgid "Vis også tidligere" +msgstr "Vis også tidligere" + #: events/templates/events.html:18 msgid "Tilføj til kalender" msgstr "" @@ -739,8 +746,8 @@ msgstr "" #: guides/templates/guides.html:9 msgctxt "Fredagscaféen" msgid "" -"Her ligger alle de lækre guides, som er rare at have, når man involverer sig " -"i driften af" +"Her ligger alle de lækre guides, som er rare at have, når man involverer sig" +" i driften af" msgstr "" #: guides/templates/guides.html:12 @@ -752,12 +759,9 @@ msgstr "" #: items/templates/items.html:11 msgid "" "\n" -"\tHer kan du se Fredagscaféens faste sortiment, og mange af de ting vi er " -"kendte for at sælge.\n" -"\tMen derudover finder du altid et stort sortiment af spændende og nye " -"specialøl, for enhver smag, i baren.\n" -"\tVi har i Fredagscaféen et stort fokus på at have noget for alle, så derfor " -"finder du også flere\n" +"\tHer kan du se Fredagscaféens faste sortiment, og mange af de ting vi er kendte for at sælge.\n" +"\tMen derudover finder du altid et stort sortiment af spændende og nye specialøl, for enhver smag, i baren.\n" +"\tVi har i Fredagscaféen et stort fokus på at have noget for alle, så derfor finder du også flere\n" "\tglutenfrie og alkoholfrie øl.\n" "\t" msgstr "" @@ -886,8 +890,8 @@ msgstr "" #: udlejning/models.py:64 msgid "" -"Hvilke slags øl eller andre drikkevarer ønskes der og hvor mange fustager af " -"hver type?" +"Hvilke slags øl eller andre drikkevarer ønskes der og hvor mange fustager af" +" hver type?" msgstr "" #: udlejning/models.py:67 @@ -1010,7 +1014,8 @@ msgstr "" #: udlejning/templates/udlejning.html:42 msgid "" -"Udelukkende arrangementer der finder sted på universitetet. Dette inkluderer:" +"Udelukkende arrangementer der finder sted på universitetet. Dette " +"inkluderer:" msgstr "" #: udlejning/templates/udlejning.html:44 @@ -1027,8 +1032,8 @@ msgstr "" #: udlejning/templates/udlejning.html:50 msgid "" -"Arrangementer der finder sted på universitetet eller andetsteds, kan være af " -"privat natur. Dette inkluderer:" +"Arrangementer der finder sted på universitetet eller andetsteds, kan være af" +" privat natur. Dette inkluderer:" msgstr "" #: udlejning/templates/udlejning.html:52 @@ -1071,10 +1076,10 @@ msgstr "" #: udlejning/templates/udlejning.html:72 msgid "" -"Når du låner et anlæg, skal der på udlåningsdagen samt tilbagelevering, være " -"et bestyrelsesmedlem der står for det praktiske. Vi er alle frivillige og " -"har studier og jobs ved siden af vorest bestyrelsesarbejde, og derfor kan vi " -"ikke være sikre på at kunne stille et besyterelsesmedlem til rådighed." +"Når du låner et anlæg, skal der på udlåningsdagen samt tilbagelevering, være" +" et bestyrelsesmedlem der står for det praktiske. Vi er alle frivillige og " +"har studier og jobs ved siden af vorest bestyrelsesarbejde, og derfor kan vi" +" ikke være sikre på at kunne stille et besyterelsesmedlem til rådighed." msgstr "" #: udlejning/templates/udlejning.html:74 @@ -1091,8 +1096,8 @@ msgid "" "mulighed for at være der i en af de mulige tidsrum. Hvis ikke du skriver " "mindst 7 dage i forvejen, kan vi ikke garantere at vi kan melde ud hvorvidt " "udlejning er muligt i god tid, dog er det stadig muligt at kunne låne " -"anlægget selv hvis man melder ud i dårlig tid, vi kan blot ikke garantere at " -"der kommer et svar i god tid." +"anlægget selv hvis man melder ud i dårlig tid, vi kan blot ikke garantere at" +" der kommer et svar i god tid." msgstr "" #: udlejning/templates/udlejning.html:79 @@ -1109,7 +1114,8 @@ msgstr "" #: udlejning/templates/udlejning.html:91 msgid "" -", som kommer i 25 liters fustager. Prisen er 750 kr. pr. fustage (incl. moms)" +", som kommer i 25 liters fustager. Prisen er 750 kr. pr. fustage (incl. " +"moms)" msgstr "" #: udlejning/templates/udlejning.html:94 @@ -1374,7 +1380,8 @@ msgid "Missing from environment" msgstr "Fraværende i miljøet" #: web/views.py:48 -msgid "Login mail sendt: Tryk på linket i din modtagede mail for at logge ind." +msgid "" +"Login mail sendt: Tryk på linket i din modtagede mail for at logge ind." msgstr "" #~ msgid "Eventuelle ekstra info til bestyrelsen skrives her" diff --git a/locale/en/LC_MESSAGES/django.mo b/locale/en/LC_MESSAGES/django.mo index a3f01e765610612439c57b3b14fda0adf62e27c7..5e73decf75ac424f7d5c92331d11f3a2ac08b85c 100644 GIT binary patch delta 5059 zcmZA42~d{D9mnzIQ107{D3=$4+)+UUL^*^aig-|Bg1)9uFzQqd6;117CLWEI)GA4< zqGBYCG^Q#L3V-mvtX9~qc>how*g+HL)G02!KOc`uUFfPYXT<`c( zoJPGBOYv_w04EHw%|vfwER##YgBQg(6iaaeR-*#ijf$xYeeon}qVwpFH_;F8;uw5{ zD=?D5BCruP@f)Z>kD=PV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/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-12-12 23:42+0100\n" -"PO-Revision-Date: 2024-12-12 23:43+0050\n" +"POT-Creation-Date: 2024-12-13 20:27+0100\n" +"PO-Revision-Date: 2024-12-13 20:28+0050\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -71,7 +71,7 @@ msgstr "Balance" msgid "Total forbrug" msgstr "Total consumption" -#: bartab/templates/bartab.html:19 bartenders/templates/barplan.html:19 +#: bartab/templates/bartab.html:19 bartenders/templates/barplan.html:14 #: gallery/models.py:101 msgid "Dato" msgstr "Date" @@ -145,7 +145,7 @@ msgstr "Study" msgid "Årgang" msgstr "Year" -#: bartenders/models.py:245 +#: bartenders/models.py:247 msgid "" "Fortæl lidt om dig selv, og hvorfor du tror at lige præcist du, ville være " "en god bartender" @@ -159,52 +159,50 @@ msgstr "" msgid "Gem" msgstr "Save" -#: bartenders/templates/barplan.html:8 web/templates/base.html:75 +#: bartenders/templates/barplan.html:9 web/templates/base.html:75 msgid "Barplan" msgstr "Bar Plan" -#: bartenders/templates/barplan.html:11 bartenders/templates/barplan.html:52 -#: events/templates/events.html:12 -msgid "Vis nuværende" -msgstr "Show current" - -#: bartenders/templates/barplan.html:13 bartenders/templates/barplan.html:54 -#: events/templates/events.html:14 -msgid "Vis også tidligere" -msgstr "Also show earlier" - -#: bartenders/templates/barplan.html:20 +#: bartenders/templates/barplan.html:15 msgid "Ansvarlig" msgstr "Responsible" -#: bartenders/templates/barplan.html:21 bartenders/templates/bartenders.html:6 +#: bartenders/templates/barplan.html:16 bartenders/templates/bartenders.html:6 #: web/templates/base.html:76 msgid "Bartendere" msgstr "Bartenders" -#: bartenders/templates/barplan.html:34 +#: bartenders/templates/barplan.html:25 +msgid "This weeks friday" +msgstr "This week's friday" + +#: bartenders/templates/barplan.html:29 msgid "Bartender's first shift" msgstr "Bartender's first shift" -#: bartenders/templates/barplan.html:38 bartenders/templates/barplan.html:78 +#: bartenders/templates/barplan.html:33 bartenders/templates/barplan.html:101 #: bartenders/templates/board.html:34 gallery/templates/gallery.html:24 #: items/templates/items.html:79 msgid "Edit" msgstr "Edit" -#: bartenders/templates/barplan.html:49 bartenders/views.py:150 +#: bartenders/templates/barplan.html:78 bartenders/views.py:150 msgid "Pantvagter" msgstr "Deposit shifts" -#: bartenders/templates/barplan.html:60 +#: bartenders/templates/barplan.html:83 msgid "Uge" msgstr "Week" -#: bartenders/templates/barplan.html:61 udlejning/models.py:107 +#: bartenders/templates/barplan.html:84 udlejning/models.py:107 msgid "Ansvarlige" msgstr "Responsible" -#: bartenders/templates/barplan.html:73 +#: bartenders/templates/barplan.html:92 +msgid "Current week" +msgstr "Current week" + +#: bartenders/templates/barplan.html:96 msgid "Bartender's first deposit shift" msgstr "Bartender's first deposit shift" @@ -360,7 +358,7 @@ msgstr "Submit" msgid "Bartendertilmeldingen er lukket." msgstr "Bartender applications are closed." -#: bartenders/views.py:65 +#: bartenders/views.py:66 msgid "Din ansøgning er blevet indsendt." msgstr "Your application has been submitted." @@ -415,6 +413,14 @@ msgstr "" msgid "Bartender events" msgstr "Bartender events" +#: events/templates/events.html:12 +msgid "Vis nuværende" +msgstr "Show current" + +#: events/templates/events.html:14 +msgid "Vis også tidligere" +msgstr "Also show earlier" + #: events/templates/events.html:18 msgid "Tilføj til kalender" msgstr "Add to calender" diff --git a/web/static/css/stylesheet.css b/web/static/css/stylesheet.css index d4fd088..5f30d00 100755 --- a/web/static/css/stylesheet.css +++ b/web/static/css/stylesheet.css @@ -336,6 +336,25 @@ html.light { .breadcrumb :before { color: black; } + + .pagination { + margin: 0px; + width: 100%; + justify-content: center; + } + + .pagination a.active { + color: black; + } + + .pagination a { + padding: 5px; + } + + .pagination a:hover { + text-decoration: none; + color: black; + } } /* dark theme */ @@ -757,4 +776,23 @@ html.dark { .breadcrumb:before { color: black; } + + .pagination { + margin: 0px; + width: 100%; + justify-content: center; + } + + .pagination a.active { + color: white; + } + + .pagination a { + padding: 5px; + } + + .pagination a:hover { + text-decoration: none; + color: white; + } } diff --git a/web/templatetags/is_current_week.py b/web/templatetags/is_current_week.py new file mode 100644 index 0000000..405345b --- /dev/null +++ b/web/templatetags/is_current_week.py @@ -0,0 +1,13 @@ +from django import template + +from bartenders.models import BartenderShift + +register = template.Library() + + +@register.filter(name="is_current_week") +def is_current_week(shift): + try: + return shift.is_current_week() + except BartenderShift.DoesNotExist: + return False