mirror of https://gitlab.crans.org/bde/nk20
We can view and update our WEI registration while we are not fully registered to the WEI.
This commit is contained in:
parent
96a87483cc
commit
cdff0d3893
|
@ -1482,7 +1482,7 @@
|
||||||
"wei",
|
"wei",
|
||||||
"weiregistration"
|
"weiregistration"
|
||||||
],
|
],
|
||||||
"query": "{\"user\": [\"user\"], \"wei\": [\"club\"], \"wei__membership_start__lte\": [\"today\"]}",
|
"query": "[\"AND\", {\"user\": [\"user\"]}, [\"OR\", {\"wei\": [\"club\"]}, {\"wei__year\": [\"today\", \"year\"], \"membership\": null}]]",
|
||||||
"type": "view",
|
"type": "view",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "",
|
"field": "",
|
||||||
|
@ -1527,7 +1527,7 @@
|
||||||
"wei",
|
"wei",
|
||||||
"weiregistration"
|
"weiregistration"
|
||||||
],
|
],
|
||||||
"query": "{\"user\": [\"user\"], \"wei\": [\"club\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}",
|
"query": "[\"AND\", {\"user\": [\"user\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}, [\"OR\", {\"wei\": [\"club\"]}, {\"wei__year\": [\"today\", \"year\"], \"membership\": null}]]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "soge_credit",
|
"field": "soge_credit",
|
||||||
|
@ -1572,7 +1572,7 @@
|
||||||
"wei",
|
"wei",
|
||||||
"weiregistration"
|
"weiregistration"
|
||||||
],
|
],
|
||||||
"query": "{\"user\": [\"user\"], \"wei\": [\"club\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}",
|
"query": "[\"AND\", {\"user\": [\"user\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}, [\"OR\", {\"wei\": [\"club\"]}, {\"wei__year\": [\"today\", \"year\"], \"membership\": null}]]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "birth_date",
|
"field": "birth_date",
|
||||||
|
@ -1602,7 +1602,7 @@
|
||||||
"wei",
|
"wei",
|
||||||
"weiregistration"
|
"weiregistration"
|
||||||
],
|
],
|
||||||
"query": "{\"user\": [\"user\"], \"wei\": [\"club\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}",
|
"query": "[\"AND\", {\"user\": [\"user\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}, [\"OR\", {\"wei\": [\"club\"]}, {\"wei__year\": [\"today\", \"year\"], \"membership\": null}]]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "gender",
|
"field": "gender",
|
||||||
|
@ -1632,7 +1632,7 @@
|
||||||
"wei",
|
"wei",
|
||||||
"weiregistration"
|
"weiregistration"
|
||||||
],
|
],
|
||||||
"query": "{\"user\": [\"user\"], \"wei\": [\"club\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}",
|
"query": "[\"AND\", {\"user\": [\"user\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}, [\"OR\", {\"wei\": [\"club\"]}, {\"wei__year\": [\"today\", \"year\"], \"membership\": null}]]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "health_issues",
|
"field": "health_issues",
|
||||||
|
@ -1662,7 +1662,7 @@
|
||||||
"wei",
|
"wei",
|
||||||
"weiregistration"
|
"weiregistration"
|
||||||
],
|
],
|
||||||
"query": "{\"user\": [\"user\"], \"wei\": [\"club\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}",
|
"query": "[\"AND\", {\"user\": [\"user\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}, [\"OR\", {\"wei\": [\"club\"]}, {\"wei__year\": [\"today\", \"year\"], \"membership\": null}]]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "emergency_contact_name",
|
"field": "emergency_contact_name",
|
||||||
|
@ -1692,7 +1692,7 @@
|
||||||
"wei",
|
"wei",
|
||||||
"weiregistration"
|
"weiregistration"
|
||||||
],
|
],
|
||||||
"query": "{\"user\": [\"user\"], \"wei\": [\"club\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}",
|
"query": "[\"AND\", {\"user\": [\"user\"], \"wei__membership_start__lte\": [\"today\"], \"wei__membership_end__gte\": [\"today\"]}, [\"OR\", {\"wei\": [\"club\"]}, {\"wei__year\": [\"today\", \"year\"], \"membership\": null}]]",
|
||||||
"type": "change",
|
"type": "change",
|
||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "emergency_contact_phone",
|
"field": "emergency_contact_phone",
|
||||||
|
|
|
@ -121,16 +121,38 @@ class WEIDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
|
||||||
bus_table = BusTable(data=buses, prefix="bus-")
|
bus_table = BusTable(data=buses, prefix="bus-")
|
||||||
context['buses'] = bus_table
|
context['buses'] = bus_table
|
||||||
|
|
||||||
# Check if the user has the right to create a membership with a random user, to display the button.
|
random_user = User.objects.filter(~Q(wei__wei__in=[club])).first()
|
||||||
empty_membership = Membership(
|
|
||||||
club=club,
|
if random_user is None:
|
||||||
user=User.objects.first(),
|
# This case occurs when all users are registered to the WEI.
|
||||||
date_start=datetime.now().date(),
|
# Don't worry, Pikachu never went to the WEI.
|
||||||
date_end=datetime.now().date(),
|
# This bug can arrive only in dev mode.
|
||||||
fee=0,
|
context["can_add_first_year_member"] = True
|
||||||
|
context["can_add_any_member"] = True
|
||||||
|
else:
|
||||||
|
# Check if the user has the right to create a registration of a random first year member.
|
||||||
|
empty_fy_registration = WEIRegistration(
|
||||||
|
user=random_user,
|
||||||
|
first_year=True,
|
||||||
|
birth_date="1970-01-01",
|
||||||
|
gender="No",
|
||||||
|
emergency_contact_name="No",
|
||||||
|
emergency_contact_phone="No",
|
||||||
)
|
)
|
||||||
context["can_add_members"] = PermissionBackend \
|
context["can_add_first_year_member"] = PermissionBackend \
|
||||||
.check_perm(self.request.user, "member.add_membership", empty_membership)
|
.check_perm(self.request.user, "wei.add_weiregistration", empty_fy_registration)
|
||||||
|
|
||||||
|
# Check if the user has the right to create a registration of a random old member.
|
||||||
|
empty_old_registration = WEIRegistration(
|
||||||
|
user=User.objects.filter(~Q(wei__wei__in=[club])).first(),
|
||||||
|
first_year=False,
|
||||||
|
birth_date="1970-01-01",
|
||||||
|
gender="No",
|
||||||
|
emergency_contact_name="No",
|
||||||
|
emergency_contact_phone="No",
|
||||||
|
)
|
||||||
|
context["can_add_any_member"] = PermissionBackend \
|
||||||
|
.check_perm(self.request.user, "wei.add_weiregistration", empty_old_registration)
|
||||||
|
|
||||||
empty_bus = Bus(
|
empty_bus = Bus(
|
||||||
wei=club,
|
wei=club,
|
||||||
|
|
|
@ -58,8 +58,10 @@
|
||||||
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_list' %}"> {% trans "WEI list" %}</a>
|
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_list' %}"> {% trans "WEI list" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if club.is_current_wei %}
|
{% if club.is_current_wei %}
|
||||||
{% if can_add_members %}
|
{% if can_add_first_year_member %}
|
||||||
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_1A' wei_pk=club.pk %}"> {% trans "Register 1A" %}</a>
|
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_1A' wei_pk=club.pk %}"> {% trans "Register 1A" %}</a>
|
||||||
|
{% endif %}
|
||||||
|
{% if can_add_any_member %}
|
||||||
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_2A' wei_pk=club.pk %}"> {% trans "Register 2A+" %}</a>
|
<a class="btn btn-primary btn-sm my-1" href="{% url 'wei:wei_register_2A' wei_pk=club.pk %}"> {% trans "Register 2A+" %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if "wei.change_"|has_perm:club %}
|
{% if "wei.change_"|has_perm:club %}
|
||||||
|
|
Loading…
Reference in New Issue