cmsmanage/membershipworks/views.py

15 lines
375 B
Python
Raw Normal View History

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()