diff --git a/apps/wei/forms/registration.py b/apps/wei/forms/registration.py index 38568b93..4890fdce 100644 --- a/apps/wei/forms/registration.py +++ b/apps/wei/forms/registration.py @@ -194,3 +194,4 @@ class BusTeamForm(forms.ModelForm): ), "color": ColorWidget(), } + # "color": ColorWidget(), diff --git a/apps/wei/migrations/0011_alter_weiclub_year.py b/apps/wei/migrations/0011_alter_weiclub_year.py new file mode 100644 index 00000000..086ea4eb --- /dev/null +++ b/apps/wei/migrations/0011_alter_weiclub_year.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.21 on 2025-05-25 12:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('wei', '0010_remove_weiregistration_specific_diet'), + ] + + operations = [ + migrations.AlterField( + model_name='weiclub', + name='year', + field=models.PositiveIntegerField(default=2025, unique=True, verbose_name='year'), + ), + ] diff --git a/apps/wei/templates/wei/busteam_detail.html b/apps/wei/templates/wei/busteam_detail.html index 27348d03..1b5dc3c3 100644 --- a/apps/wei/templates/wei/busteam_detail.html +++ b/apps/wei/templates/wei/busteam_detail.html @@ -18,6 +18,8 @@ SPDX-License-Identifier: GPL-3.0-or-later diff --git a/apps/wei/templates/wei/busteam_form.html b/apps/wei/templates/wei/busteam_form.html index c62fec40..24522a80 100644 --- a/apps/wei/templates/wei/busteam_form.html +++ b/apps/wei/templates/wei/busteam_form.html @@ -13,9 +13,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% csrf_token %} + {{ form.media }} {{ form|crispy }}
+ {% endblock %} \ No newline at end of file diff --git a/apps/wei/views.py b/apps/wei/views.py index a2e8ccff..5683478a 100644 --- a/apps/wei/views.py +++ b/apps/wei/views.py @@ -440,6 +440,13 @@ class BusTeamCreateView(ProtectQuerysetMixin, ProtectedCreateView): def get_success_url(self): self.object.refresh_from_db() return reverse_lazy("wei:manage_bus_team", kwargs={"pk": self.object.pk}) + + def get_template_names(self): + names = super().get_template_names() + return names + + + class BusTeamUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView): @@ -472,6 +479,13 @@ class BusTeamUpdateView(ProtectQuerysetMixin, LoginRequiredMixin, UpdateView): def get_success_url(self): self.object.refresh_from_db() return reverse_lazy("wei:manage_bus_team", kwargs={"pk": self.object.pk}) + + def get_template_names(self): + names = super().get_template_names() + return names + + + class BusTeamManageView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): diff --git a/note_kfet/inputs.py b/note_kfet/inputs.py index a05b61e4..6de3c7d9 100644 --- a/note_kfet/inputs.py +++ b/note_kfet/inputs.py @@ -63,8 +63,16 @@ class ColorWidget(Widget): def format_value(self, value): if value is None: value = 0xFFFFFF - return "#{:06X}".format(value) + if isinstance(value, str): + return value # Assume it's already a hex string like "#FFAA33" + try: + return "#{:06X}".format(value) + except Exception: + return "#FFFFFF" + def value_from_datadict(self, data, files, name): val = super().value_from_datadict(data, files, name) - return int(val[1:], 16) + if val: + return int(val[1:], 16) + return None \ No newline at end of file diff --git a/note_kfet/templates/colorfield/color.html b/note_kfet/templates/colorfield/color.html new file mode 100644 index 00000000..5c0457c5 --- /dev/null +++ b/note_kfet/templates/colorfield/color.html @@ -0,0 +1,5 @@ + \ No newline at end of file