From 6b6a5e0e13b762d7796f57d2042cb8f57b98745d Mon Sep 17 00:00:00 2001 From: Anders Bruun Severinsen <202204885@post.au.dk> Date: Thu, 17 Oct 2024 20:34:34 +0200 Subject: [PATCH 1/9] Added bootstrap5 --- bartenders/forms.py | 1 + .../migrations/0003_auto_20241017_2029.py | 49 +++++++++++++++++++ bartenders/models.py | 18 +++---- bartenders/templates/ballots.html | 2 +- bartenders/templates/ballots_update.html | 6 ++- bartenders/templates/bartender_info.html | 10 ++-- bartenders/templates/index.html | 6 ++- events/forms.py | 4 ++ events/templates/events.html | 6 ++- fredagscafeen/settings/base.py | 7 +-- requirements.in | 2 +- requirements.txt | 4 +- udlejning/forms.py | 1 + udlejning/templates/udlejning.html | 6 ++- web/static/css/stylesheet.css | 5 ++ web/templates/base.html | 2 +- web/templates/login.html | 6 ++- 17 files changed, 105 insertions(+), 30 deletions(-) create mode 100644 bartenders/migrations/0003_auto_20241017_2029.py diff --git a/bartenders/forms.py b/bartenders/forms.py index a0abf87..eb42861 100644 --- a/bartenders/forms.py +++ b/bartenders/forms.py @@ -23,6 +23,7 @@ class Meta: def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.fields["tshirt_size"].widget.attrs.update({"class": "form-control"}) for name in self.fields: self.fields[name].required = name != "info" diff --git a/bartenders/migrations/0003_auto_20241017_2029.py b/bartenders/migrations/0003_auto_20241017_2029.py new file mode 100644 index 0000000..4056b66 --- /dev/null +++ b/bartenders/migrations/0003_auto_20241017_2029.py @@ -0,0 +1,49 @@ +# Generated by Django 3.2.4 on 2024-10-17 18:29 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("bartenders", "0002_ballotlink_poll"), + ] + + operations = [ + migrations.AlterField( + model_name="bartender", + name="tshirt_size", + field=models.IntegerField( + blank=True, + choices=[ + (0, "XS"), + (1, "S"), + (2, "M"), + (3, "L"), + (4, "XL"), + (5, "XXL"), + (6, "XXXL"), + ], + null=True, + verbose_name="T-shirt størrelse", + ), + ), + migrations.AlterField( + model_name="bartenderapplication", + name="tshirt_size", + field=models.IntegerField( + blank=True, + choices=[ + (0, "XS"), + (1, "S"), + (2, "M"), + (3, "L"), + (4, "XL"), + (5, "XXL"), + (6, "XXXL"), + ], + null=True, + verbose_name="T-shirt størrelse", + ), + ), + ] diff --git a/bartenders/models.py b/bartenders/models.py index c0bb11b..e46fb63 100644 --- a/bartenders/models.py +++ b/bartenders/models.py @@ -2,6 +2,7 @@ from enum import IntEnum from urllib.parse import urljoin +from django import forms from django.conf import settings from django.db import models from django.db.models import Q @@ -36,13 +37,13 @@ def date_format(dt, format): # but we enforce that in BartenderApplicationForm for new applications. class BartenderCommon(models.Model): TSHIRT_SIZE_CHOICES = ( - ("XS", "XS"), - ("S", "S"), - ("M", "M"), - ("L", "L"), - ("XL", "XL"), - ("XXL", "XXL"), - ("XXXL", "XXXL"), + (0, "XS"), + (1, "S"), + (2, "M"), + (3, "L"), + (4, "XL"), + (5, "XXL"), + (6, "XXXL"), ) class Meta: @@ -59,9 +60,8 @@ class Meta: phoneNumber = models.IntegerField( blank=True, null=True, verbose_name=_("Telefonnummer") ) - tshirt_size = models.CharField( + tshirt_size = models.IntegerField( choices=TSHIRT_SIZE_CHOICES, - max_length=10, blank=True, null=True, verbose_name=_("T-shirt størrelse"), diff --git a/bartenders/templates/ballots.html b/bartenders/templates/ballots.html index 325a135..92a0903 100644 --- a/bartenders/templates/ballots.html +++ b/bartenders/templates/ballots.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% load static %} -{% load bootstrap3 %} +{% load bootstrap5 %} {% block content %} diff --git a/bartenders/templates/ballots_update.html b/bartenders/templates/ballots_update.html index cbe49c1..60fac06 100644 --- a/bartenders/templates/ballots_update.html +++ b/bartenders/templates/ballots_update.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% load i18n %} {% load static %} -{% load bootstrap3 %} +{% load bootstrap5 bootstrap_icons %} {% block content %} @@ -16,7 +16,9 @@