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.
f870af139e
...
b706efe463
@ -131,7 +131,7 @@ class UserDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView):
|
|||||||
"""
|
"""
|
||||||
We can't display information of a not registered user.
|
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):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
@ -33,9 +33,7 @@ class TransactionCreateView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTabl
|
|||||||
extra_context = {"title": _("Transfer money")}
|
extra_context = {"title": _("Transfer money")}
|
||||||
|
|
||||||
def get_queryset(self, **kwargs):
|
def get_queryset(self, **kwargs):
|
||||||
return Transaction.objects.filter(
|
return super().get_queryset(**kwargs).order_by("-created_at").all()[:20]
|
||||||
PermissionBackend.filter_queryset(self.request.user, Transaction, "view")
|
|
||||||
).order_by("-created_at").all()[:20]
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
@ -141,9 +139,7 @@ class ConsoView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableView):
|
|||||||
table_class = HistoryTable
|
table_class = HistoryTable
|
||||||
|
|
||||||
def get_queryset(self, **kwargs):
|
def get_queryset(self, **kwargs):
|
||||||
return Transaction.objects.filter(
|
return super().get_queryset(**kwargs).order_by("-created_at")[:20]
|
||||||
PermissionBackend.filter_queryset(self.request.user, Transaction, "view")
|
|
||||||
).order_by("-created_at").all()[:20]
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
"mask": 1,
|
"mask": 1,
|
||||||
"field": "",
|
"field": "",
|
||||||
"permanent": true,
|
"permanent": true,
|
||||||
"description": "Voir sa propre note d'utilisateur"
|
"description": "Vioir sa propre note d'utilisateur"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -353,7 +353,7 @@
|
|||||||
],
|
],
|
||||||
"query": "{\"pk\": [\"club\", \"pk\"]}",
|
"query": "{\"pk\": [\"club\", \"pk\"]}",
|
||||||
"type": "view",
|
"type": "view",
|
||||||
"mask": 1,
|
"mask": 3,
|
||||||
"field": "",
|
"field": "",
|
||||||
"permanent": false,
|
"permanent": false,
|
||||||
"description": "Voir les informations d'un club"
|
"description": "Voir les informations d'un club"
|
||||||
@ -868,7 +868,7 @@
|
|||||||
"mask": 3,
|
"mask": 3,
|
||||||
"field": "",
|
"field": "",
|
||||||
"permanent": false,
|
"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+"
|
"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",
|
"model": "permission.role",
|
||||||
"pk": 1,
|
"pk": 1,
|
||||||
@ -2330,7 +2282,6 @@
|
|||||||
11,
|
11,
|
||||||
12,
|
12,
|
||||||
13,
|
13,
|
||||||
22,
|
|
||||||
48,
|
48,
|
||||||
52,
|
52,
|
||||||
126
|
126
|
||||||
@ -2355,7 +2306,6 @@
|
|||||||
15,
|
15,
|
||||||
16,
|
16,
|
||||||
17,
|
17,
|
||||||
22,
|
|
||||||
78,
|
78,
|
||||||
79,
|
79,
|
||||||
83,
|
83,
|
||||||
@ -2377,9 +2327,7 @@
|
|||||||
"fields": {
|
"fields": {
|
||||||
"for_club": null,
|
"for_club": null,
|
||||||
"name": "Membre de club",
|
"name": "Membre de club",
|
||||||
"permissions": [
|
"permissions": []
|
||||||
22
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2389,6 +2337,7 @@
|
|||||||
"for_club": null,
|
"for_club": null,
|
||||||
"name": "Bureau de club",
|
"name": "Bureau de club",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
|
22,
|
||||||
47,
|
47,
|
||||||
49,
|
49,
|
||||||
50,
|
50,
|
||||||
@ -2488,9 +2437,7 @@
|
|||||||
137,
|
137,
|
||||||
138,
|
138,
|
||||||
139,
|
139,
|
||||||
143,
|
143
|
||||||
146,
|
|
||||||
147
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2640,10 +2587,7 @@
|
|||||||
141,
|
141,
|
||||||
142,
|
142,
|
||||||
143,
|
143,
|
||||||
144,
|
144
|
||||||
145,
|
|
||||||
146,
|
|
||||||
147
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -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",
|
"model": "wei.weirole",
|
||||||
"pk": 12,
|
"pk": 12,
|
||||||
|
@ -20,7 +20,7 @@ class ProtectQuerysetMixin:
|
|||||||
"""
|
"""
|
||||||
def get_queryset(self, **kwargs):
|
def get_queryset(self, **kwargs):
|
||||||
qs = super().get_queryset(**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):
|
def get_form(self, form_class=None):
|
||||||
form = super().get_form(form_class)
|
form = super().get_form(form_class)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 1f300c3b7bac0b7a31c1a252a83ba68a8268d33d
|
Subproject commit 4b37f8286f493b1a28bd0faa0052ee3967fe543e
|
@ -18,8 +18,7 @@ $(document).ready(function () {
|
|||||||
html += li(prefix + "_" + obj.id, obj[name_field]);
|
html += li(prefix + "_" + obj.id, obj[name_field]);
|
||||||
});
|
});
|
||||||
|
|
||||||
let results_list = $("#" + prefix + "_list");
|
$("#" + prefix + "_list").html(html);
|
||||||
results_list.html(html);
|
|
||||||
|
|
||||||
objects.results.forEach(function (obj) {
|
objects.results.forEach(function (obj) {
|
||||||
$("#" + prefix + "_" + obj.id).click(function() {
|
$("#" + prefix + "_" + obj.id).click(function() {
|
||||||
@ -33,10 +32,6 @@ $(document).ready(function () {
|
|||||||
if (input === obj[name_field])
|
if (input === obj[name_field])
|
||||||
$("#" + prefix + "_pk").val(obj.id);
|
$("#" + prefix + "_pk").val(obj.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (results_list.children().length === 1 && e.originalEvent.keyCode >= 32) {
|
|
||||||
results_list.children().first().trigger("click");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
@ -86,8 +86,8 @@ function getMatchedNotes(pattern, fun) {
|
|||||||
* Generate a <li> entry with a given id and text
|
* Generate a <li> entry with a given id and text
|
||||||
*/
|
*/
|
||||||
function li(id, text, extra_css) {
|
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 "
|
return "<li class=\"list-group-item py-1 px-2 d-flex justify-content-between align-items-center text-truncate " + extra_css + "\"" +
|
||||||
+ (extra_css ? extra_css : "") + "\"" + " id=\"" + id + "\">" + text + "</li>\n";
|
" id=\"" + id + "\">" + text + "</li>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user