Commit d4456173 authored by Nicolas Joyard's avatar Nicolas Joyard

Remove autocomplete viewsets

parent 0351327f
from dal import autocomplete
from django.db.models import Q
from models import Dossier, Proposal
class DossierAutocomplete(autocomplete.Select2QuerySetView):
def get_queryset(self):
qs = Dossier.objects.all()
if self.q:
qs = qs.filter(
Q(title__icontains=self.q) |
Q(reference__icontains=self.q)
)
return qs
class ProposalAutocomplete(autocomplete.Select2QuerySetView):
def get_queryset(self):
qs = Proposal.objects.all()
if self.q:
qs = qs.filter(
Q(dossier__title__icontains=self.q) |
Q(title__icontains=self.q) |
Q(reference__icontains=self.q)
)
return qs
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment