1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Compare commits

..

No commits in common. "6c9cf73848d637f4874f4d8dba5890a7308ed278" and "a096dc44271dcd46769c197bd1419a08a189d89c" have entirely different histories.

4 changed files with 9 additions and 53 deletions

View File

@ -8,15 +8,12 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Q
from django.template import loader
from django.urls import reverse, reverse_lazy
from django.utils import timezone
from django.utils.encoding import force_bytes
from django.utils.http import urlsafe_base64_encode
from django.utils.translation import gettext_lazy as _
from permission.models import Role
from registration.tokens import email_validation_token
from note.models import MembershipTransaction
@ -385,17 +382,6 @@ class Membership(models.Model):
if hasattr(self, '_force_save'):
parent_membership._force_save = True
parent_membership.save()
parent_membership.refresh_from_db()
if self.club.parent_club.name == "BDE":
parent_membership.roles.set(
Role.objects.filter(Q(name="Adhérent BDE") | Q(name="Membre de club")).all())
elif self.club.parent_club.name == "Kfet":
parent_membership.roles.set(
Role.objects.filter(Q(name="Adhérent Kfet") | Q(name="Membre de club")).all())
else:
parent_membership.roles.set(Role.objects.filter(name="Membre de club").all())
parent_membership.save()
else:
raise ValidationError(_('User is not a member of the parent club')
+ ' ' + self.club.parent_club.name)

View File

@ -631,12 +631,7 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
ret = super().form_valid(form)
if club.name == "BDE":
member_role = Role.objects.filter(Q(name="Adhérent BDE") | Q(name="Membre de club")).all()
elif club.name == "Kfet":
member_role = Role.objects.filter(Q(name="Adhérent Kfet") | Q(name="Membre de club")).all()
else:
member_role = Role.objects.filter(name="Membre de club").all()
member_role = Role.objects.filter(name="Membre de club").all()
form.instance.roles.set(member_role)
form.instance._force_save = True
form.instance.save()
@ -675,10 +670,8 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, CreateView):
membership.refresh_from_db()
if old_membership.exists():
membership.roles.set(old_membership.get().roles.all())
elif c.name == "BDE":
membership.roles.set(Role.objects.filter(Q(name="Adhérent BDE") | Q(name="Membre de club")).all())
elif c.name == "Kfet":
membership.roles.set(Role.objects.filter(Q(name="Adhérent Kfet") | Q(name="Membre de club")).all())
else:
membership.roles.add(Role.objects.get(name="Adhérent Kfet"))
membership.save()
return ret

View File

@ -61,7 +61,7 @@
"fields": {
"model": [
"note",
"note"
"noteuser"
],
"query": "{\"pk\": [\"user\", \"note\", \"pk\"]}",
"type": "view",
@ -2221,9 +2221,9 @@
"fields": {
"model": [
"note",
"note"
"noteclub"
],
"query": "{\"noteclub__club\": [\"club\"]}",
"query": "{\"club\": [\"club\"]}",
"type": "view",
"mask": 2,
"field": "",
@ -2343,22 +2343,6 @@
"description": "Supprimer une activité non validée"
}
},
{
"model": "permission.permission",
"pk": 150,
"fields": {
"model": [
"note",
"note"
],
"query": "{}",
"type": "view",
"mask": 2,
"field": "",
"permanent": false,
"description": "Voir toutes les notes"
}
},
{
"model": "permission.role",
"pk": 1,
@ -2538,8 +2522,7 @@
139,
143,
146,
147,
150
147
]
}
},
@ -2694,8 +2677,7 @@
146,
147,
148,
149,
150
149
]
}
},
@ -2755,7 +2737,6 @@
"for_club": null,
"name": "GC WEI",
"permissions": [
22,
76,
85,
86,
@ -2789,7 +2770,6 @@
"for_club": null,
"name": "Chef de bus",
"permissions": [
22,
84,
117,
118,
@ -2807,7 +2787,6 @@
"for_club": null,
"name": "Chef d'\u00e9quipe",
"permissions": [
22,
84,
116,
123,
@ -2823,7 +2802,6 @@
"for_club": null,
"name": "\u00c9lectron libre",
"permissions": [
22,
84
]
}
@ -2835,7 +2813,6 @@
"for_club": null,
"name": "\u00c9lectron libre (avec perm)",
"permissions": [
22,
84
]
}

View File

@ -12,7 +12,7 @@
{% include "member/club_info.html" %}
{% endwith %}
{% elif note.user %}
{% with user_object=note.user %}
{% with user=note.user %}
{% include "member/profile_info.html" %}
{% endwith %}
{% endif %}