Instantiate the Compose classes in their own file

This commit is contained in:
Martin Pépin 2020-07-18 16:05:16 +02:00
parent 7caee5665b
commit 9ac030fd16
No known key found for this signature in database
GPG key ID: E7520278B1774448
4 changed files with 13 additions and 7 deletions

View file

@ -47,7 +47,7 @@ class COFLDAPSearch(autocomplete.LDAPSearch):
return reverse("clipper-registration", args=(clipper.clipper, clipper.fullname))
class COFSearch(autocomplete.Compose):
class COFAutocomplete(autocomplete.Compose):
search_units = [
("members", COFMemberSearch()),
("others", COFOthersSearch()),
@ -55,4 +55,4 @@ class COFSearch(autocomplete.Compose):
]
cof_search = COFSearch()
cof_autocomplete = COFAutocomplete()

View file

@ -25,7 +25,7 @@ from django_cas_ng.views import LogoutView as CasLogoutView
from icalendar import Calendar, Event as Vevent
from bda.models import Spectacle, Tirage
from gestioncof.autocomplete import COFSearch
from gestioncof.autocomplete import cof_autocomplete
from gestioncof.decorators import BuroRequiredMixin, buro_required, cof_required
from gestioncof.forms import (
CalendarForm,
@ -950,4 +950,4 @@ class UserAutocompleteView(BuroRequiredMixin, Select2QuerySetView):
class RegistrationAutocompleteView(BuroRequiredMixin, AutocompleteView):
template_name = "gestioncof/search_results.html"
search_composer = COFSearch()
search_composer = cof_autocomplete

View file

@ -80,5 +80,11 @@ class KfetAutocomplete(autocomplete.Compose):
]
kfet_autocomplete = KfetAutocomplete()
class KfetAccountOnlyAutocomplete(autocomplete.Compose):
search_units = [("kfet", KfetAccountSearch())]
kfet_account_only_autocomplete = KfetAccountOnlyAutocomplete()

View file

@ -27,7 +27,7 @@ from django.views.generic.edit import CreateView, DeleteView, UpdateView
from gestioncof.models import CofProfile
from kfet import KFET_DELETED_TRIGRAMME, consumers
from kfet.auth.decorators import kfet_password_auth
from kfet.autocomplete import KfetAccountOnlyAutocomplete, KfetAutocomplete
from kfet.autocomplete import kfet_account_only_autocomplete, kfet_autocomplete
from kfet.config import kfet_config
from kfet.decorators import teamkfet_required
from kfet.forms import (
@ -2597,9 +2597,9 @@ class ArticleStatSales(ScaleMixin, JSONDetailView):
class AccountCreateAutocompleteView(PermissionRequiredMixin, AutocompleteView):
permission_required = "kfet.is_team"
search_composer = KfetAutocomplete()
search_composer = kfet_autocomplete
class AccountSearchAutocompleteView(PermissionRequiredMixin, AutocompleteView):
permission_required = "kfet.is_team"
search_composer = KfetAccountOnlyAutocomplete()
search_composer = kfet_account_only_autocomplete