1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-07-23 09:16:48 +02:00

Compare commits

..

13 Commits

Author SHA1 Message Date
a2e2ff5fa9 Merge branch 'main' into 'wei'
Main

See merge request bde/nk20!319
2025-05-26 17:51:33 +02:00
ff812a028c Merge branch 'darbonne' into 'main'
Darbonne

See merge request bde/nk20!318
2025-05-26 16:47:03 +02:00
136f636fda Fix de l'ajout d'équipe, le ColorWidget était défaillant 2025-05-25 23:31:09 +02:00
5a8acbde00 Trez TaT en moins 2025-05-25 00:07:07 +02:00
f60dc8cfa0 Pré-injection du BDA 2025-05-25 00:05:13 +02:00
067dd6f9d1 WEI-Roles 2025-05-24 22:41:53 +02:00
7b1e32e514 Réécriture des rôles pertinents 2025-05-24 22:29:11 +02:00
e88dbfd597 Merge branch 'darbonne' into 'main'
Faute de frappe

See merge request bde/nk20!317
2025-05-23 23:57:18 +02:00
3d34270959 Faute de frappe 2025-05-23 23:38:06 +02:00
3bb99671ec Merge branch 'ehouarn-main-patch-70724' into 'main'
Update views.py

See merge request bde/nk20!316
2025-05-19 18:03:00 +02:00
0d69383dfd Update views.py 2025-05-19 17:45:01 +02:00
7b9ff119e8 Merge branch 'food_bugs' into 'main'
Corrections de quelques bugs (par Quark)

See merge request bde/nk20!315
2025-05-10 19:46:44 +02:00
9643d7652b Merge branch 'delete_activity' into 'main'
migrations

See merge request bde/nk20!314
2025-05-09 20:15:46 +02:00
10 changed files with 260 additions and 21 deletions

View File

@ -263,7 +263,7 @@ class TransformedFoodCreateView(ProtectQuerysetMixin, ProtectedCreateView):
return reverse_lazy('food:transformedfood_view', kwargs={"pk": self.object.pk})
MAX_FORMS = 10
MAX_FORMS = 100
class ManageIngredientsView(LoginRequiredMixin, UpdateView):

View File

@ -0,0 +1,46 @@
from django.db import migrations
def create_bda(apps, schema_editor):
"""
The club BDA is now pre-injected.
"""
Club = apps.get_model("member", "club")
NoteClub = apps.get_model("note", "noteclub")
Alias = apps.get_model("note", "alias")
ContentType = apps.get_model('contenttypes', 'ContentType')
polymorphic_ctype_id = ContentType.objects.get_for_model(NoteClub).id
Club.objects.get_or_create(
id=10,
name="BDA",
email="bda.ensparissaclay@gmail.com",
require_memberships=True,
membership_fee_paid=750,
membership_fee_unpaid=750,
membership_duration=396,
membership_start="2024-08-01",
membership_end="2025-09-30",
)
NoteClub.objects.get_or_create(
id=1937,
club_id=10,
polymorphic_ctype_id=polymorphic_ctype_id,
)
Alias.objects.get_or_create(
id=1937,
note_id=1937,
name="BDA",
normalized_name="bda",
)
class Migration(migrations.Migration):
dependencies = [
('member', '0013_auto_20240801_1436'),
]
operations = [
migrations.RunPython(create_bda),
]

View File

@ -4091,8 +4091,8 @@
158,
159,
160,
212,
222
212,
222
]
}
},
@ -4133,14 +4133,14 @@
50,
141,
169,
217,
218,
219,
220,
221,
247,
258,
259
217,
218,
219,
220,
221,
247,
258,
259
]
}
},
@ -4152,8 +4152,8 @@
"name": "Pr\u00e9sident\u22c5e de club",
"permissions": [
62,
142,
135
135,
142
]
}
},
@ -4538,8 +4538,8 @@
"name": "GC anti-VSS",
"permissions": [
42,
135,
150,
135,
150,
163,
164
]
@ -4555,13 +4555,140 @@
137,
211,
212,
213,
214,
215,
216
213,
214,
215,
216
]
}
},
{
"model": "permission.role",
"pk": 23,
"fields": {
"for_club": 2,
"name": "Darbonne",
"permissions": [
30,
31,
32
]
}
},
{
"model": "permission.role",
"pk": 24,
"fields": {
"for_club": null,
"name": "Staffeur⋅euse (S&L,Respo Tech,...)",
"permissions": []
}
},
{
"model": "permission.role",
"pk": 25,
"fields": {
"for_club": null,
"name": "Référent⋅e Bus",
"permissions": [
22,
84,
115,
117,
118,
119,
120,
121,
122
]
}
},
{
"model": "permission.role",
"pk": 28,
"fields": {
"for_club": 10,
"name": "Trésorièr⸱e BDA",
"permissions": [
55,
56,
57,
58,
135,
143,
176,
177,
178,
243,
260,
261,
262,
263,
264,
265,
266,
267,
268,
269
]
}
},
{
"model": "permission.role",
"pk": 30,
"fields": {
"for_club": 10,
"name": "Respo sorties",
"permissions": [
49,
62,
141,
241,
242,
243
]
}
},
{
"model": "permission.role",
"pk": 31,
"fields": {
"for_club": 1,
"name": "Respo comm",
"permissions": [
135,
244
]
}
},
{
"model": "permission.role",
"pk": 32,
"fields": {
"for_club": 10,
"name": "Respo comm Art",
"permissions": [
135,
245
]
}
},
{
"model": "permission.role",
"pk": 33,
"fields": {
"for_club": 10,
"name": "Respo Jam",
"permissions": [
247,
250,
251,
252,
253,
254
]
}
},
{
"model": "wei.weirole",
"pk": 12,
@ -4596,5 +4723,15 @@
"model": "wei.weirole",
"pk": 18,
"fields": {}
},
{
"model": "wei.weirole",
"pk": 24,
"fields": {}
},
{
"model": "wei.weirole",
"pk": 25,
"fields": {}
}
]

View File

@ -194,3 +194,4 @@ class BusTeamForm(forms.ModelForm):
),
"color": ColorWidget(),
}
# "color": ColorWidget(),

View File

@ -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'),
),
]

View File

@ -18,6 +18,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="card-footer text-center">
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:update_bus' pk=bus.pk %}"
data-turbolinks="false">{% trans "Edit" %}</a>
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:manage_bus' pk=bus.pk %}"
data-turbolinks="false">{% trans "View" %}</a>
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:add_team' pk=bus.pk %}"
data-turbolinks="false">{% trans "Add team" %}</a>
</div>

View File

@ -13,9 +13,17 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="card-body">
<form method="post">
{% csrf_token %}
{{ form.media }}
{{ form|crispy }}
<button class="btn btn-primary" type="submit">{% trans "Submit" %}</button>
</form>
</div>
</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
if (window.jscolor && jscolor.install) {
jscolor.install();
}
});
</script>
{% endblock %}

View File

@ -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):

View File

@ -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

View File

@ -0,0 +1,5 @@
<input type="text"
name="{{ widget.name }}"
value="{{ widget.value }}"
class="jscolor"
{% include "django/forms/widgets/attrs.html" %}>