2022-05-05 17:21:48 -04:00
|
|
|
from dal import autocomplete
|
2022-02-03 13:45:58 -05:00
|
|
|
|
2022-05-05 17:21:48 -04:00
|
|
|
from .models import Member
|
|
|
|
|
|
|
|
|
|
|
|
class MemberAutocomplete(autocomplete.Select2QuerySetView):
|
|
|
|
model = Member
|
|
|
|
search_fields = ["account_name"]
|
|
|
|
|
|
|
|
def get_queryset(self):
|
|
|
|
if not self.request.user.has_perm("membershipworks.view_member"):
|
|
|
|
return Member.objects.none()
|
|
|
|
else:
|
|
|
|
return super().get_queryset()
|