# generated by appcreator
from django.db.models import Q
from dal import autocomplete
from gn_places.models import GeoNamesPlace


class GeoNamesPlaceAC(autocomplete.Select2QuerySetView):
    def get_queryset(self):
        qs = GeoNamesPlace.objects.all()

        if self.q:
            qs = qs.filter(
                Q(gn_name__icontains=self.q)
            )
        return qs
