mirror of
https://gitlab.crans.org/bde/nk20
synced 2025-06-22 10:28:21 +02:00
Club members autocomplete
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
|
||||
# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
from dal import autocomplete
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from django.views.generic import CreateView, ListView, DetailView, UpdateView
|
||||
@ -115,6 +115,18 @@ class UserListView(LoginRequiredMixin,SingleTableView):
|
||||
return context
|
||||
|
||||
|
||||
class UserAutocomplete(autocomplete.Select2QuerySetView):
|
||||
"""
|
||||
Auto complete note by aliases
|
||||
"""
|
||||
def get_queryset(self):
|
||||
qs = User.objects.all()
|
||||
|
||||
if self.q:
|
||||
qs = qs.filter(username__regex=self.q)
|
||||
|
||||
return qs
|
||||
|
||||
###################################
|
||||
############## CLUB ###############
|
||||
###################################
|
||||
|
Reference in New Issue
Block a user