cmsmanage/membershipworks/views.py
Adam Goldsmith e14e57c39e [rentals] Use django-autocomplete-light for locker renter selection
This primarily to make the list of members not block/slow down
loading excessively, as it was currently doing
2022-05-05 17:23:36 -04:00

15 lines
375 B
Python

from dal import autocomplete
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()