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. "f870af139e92b17ba59f4d12f4f02d9bf8147a5d" and "b706efe463b5ec78309c6ef4c9a3b99bac6f41f0" have entirely different histories.

7 changed files with 15 additions and 104 deletions

View File

@ -131,7 +131,7 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
"""
We can't display information of a not registered user.
"""
return super().get_queryset().filter(profile__registration_valid=True)
return super().get_queryset().filter(profile__registration_valid=True).distinct()
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)

View File

@ -33,9 +33,7 @@ class TransactionCreateView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTabl
extra_context = {"title": _("Transfer money")}
def get_queryset(self, **kwargs):
return Transaction.objects.filter(
PermissionBackend.filter_queryset(self.request.user, Transaction, "view")
).order_by("-created_at").all()[:20]
return super().get_queryset(**kwargs).order_by("-created_at").all()[:20]
def get_context_data(self, **kwargs):
"""
@ -141,9 +139,7 @@ class ConsoView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
table_class = HistoryTable
def get_queryset(self, **kwargs):
return Transaction.objects.filter(
PermissionBackend.filter_queryset(self.request.user, Transaction, "view")
).order_by("-created_at").all()[:20]
return super().get_queryset(**kwargs).order_by("-created_at")[:20]
def get_context_data(self, **kwargs):
"""

View File

@ -68,7 +68,7 @@
"mask": 1,
"field": "",
"permanent": true,
"description": "Voir sa propre note d'utilisateur"
"description": "Vioir sa propre note d'utilisateur"
}
},
{
@ -353,7 +353,7 @@
],
"query": "{\"pk\": [\"club\", \"pk\"]}",
"type": "view",
"mask": 1,
"mask": 3,
"field": "",
"permanent": false,
"description": "Voir les informations d'un club"
@ -868,7 +868,7 @@
"mask": 3,
"field": "",
"permanent": false,
"description": "Modifier n'importe quel utilisateur"
"description": "Modifier n'import quel utilisateur"
}
},
{
@ -2263,54 +2263,6 @@
"description": "Modifier mes préférences en terme de bus et d'équipe si mon inscription n'est pas validée et que je suis en 2A+"
}
},
{
"model": "permission.permission",
"pk": 145,
"fields": {
"model": [
"note",
"noteclub"
],
"query": "{}",
"type": "view",
"mask": 1,
"field": "",
"permanent": false,
"description": "Voir toutes les notes de club"
}
},
{
"model": "permission.permission",
"pk": 146,
"fields": {
"model": [
"member",
"membership"
],
"query": "{}",
"type": "view",
"mask": 3,
"field": "",
"permanent": false,
"description": "Voir tous les adhérents du club"
}
},
{
"model": "permission.permission",
"pk": 147,
"fields": {
"model": [
"member",
"membership"
],
"query": "{}",
"type": "add",
"mask": 3,
"field": "",
"permanent": false,
"description": "Ajouter un membre à n'importe quel club"
}
},
{
"model": "permission.role",
"pk": 1,
@ -2330,7 +2282,6 @@
11,
12,
13,
22,
48,
52,
126
@ -2355,7 +2306,6 @@
15,
16,
17,
22,
78,
79,
83,
@ -2377,9 +2327,7 @@
"fields": {
"for_club": null,
"name": "Membre de club",
"permissions": [
22
]
"permissions": []
}
},
{
@ -2389,6 +2337,7 @@
"for_club": null,
"name": "Bureau de club",
"permissions": [
22,
47,
49,
50,
@ -2488,9 +2437,7 @@
137,
138,
139,
143,
146,
147
143
]
}
},
@ -2640,10 +2587,7 @@
141,
142,
143,
144,
145,
146,
147
144
]
}
},
@ -2813,30 +2757,6 @@
]
}
},
{
"model": "permission.role",
"pk": 19,
"fields": {
"for_club": 1,
"name": "Secrétaire BDE",
"permissions": [
54,
55,
56,
57,
58,
135,
136,
137,
138,
139,
140,
145,
146,
147
]
}
},
{
"model": "wei.weirole",
"pk": 12,

View File

@ -20,7 +20,7 @@ class ProtectQuerysetMixin:
"""
def get_queryset(self, **kwargs):
qs = super().get_queryset(**kwargs)
return qs.filter(PermissionBackend.filter_queryset(self.request.user, qs.model, "view")).distinct()
return qs.filter(PermissionBackend.filter_queryset(self.request.user, qs.model, "view"))
def get_form(self, form_class=None):
form = super().get_form(form_class)

@ -1 +1 @@
Subproject commit 1f300c3b7bac0b7a31c1a252a83ba68a8268d33d
Subproject commit 4b37f8286f493b1a28bd0faa0052ee3967fe543e

View File

@ -18,8 +18,7 @@ $(document).ready(function () {
html += li(prefix + "_" + obj.id, obj[name_field]);
});
let results_list = $("#" + prefix + "_list");
results_list.html(html);
$("#" + prefix + "_list").html(html);
objects.results.forEach(function (obj) {
$("#" + prefix + "_" + obj.id).click(function() {
@ -33,10 +32,6 @@ $(document).ready(function () {
if (input === obj[name_field])
$("#" + prefix + "_pk").val(obj.id);
});
if (results_list.children().length === 1 && e.originalEvent.keyCode >= 32) {
results_list.children().first().trigger("click");
}
});
});
});

View File

@ -86,8 +86,8 @@ function getMatchedNotes(pattern, fun) {
* Generate a <li> entry with a given id and text
*/
function li(id, text, extra_css) {
return "<li class=\"list-group-item py-1 px-2 d-flex justify-content-between align-items-center text-truncate "
+ (extra_css ? extra_css : "") + "\"" + " id=\"" + id + "\">" + text + "</li>\n";
return "<li class=\"list-group-item py-1 px-2 d-flex justify-content-between align-items-center text-truncate " + extra_css + "\"" +
" id=\"" + id + "\">" + text + "</li>\n";
}
/**