This commit is contained in:
Sanj 2011-08-31 01:18:20 +05:30
parent 2438b51c1c
commit fe3a5556a3

View File

@ -5,15 +5,15 @@ class FeatureTypeLookup(object):
def get_query(self,q,request): def get_query(self,q,request):
""" return a query set. you also have access to request.user if needed """ """ return a query set. you also have access to request.user if needed """
return Contact.objects.filter(Q(code__icontains=q) | Q(name__icontains=q)) return FeatureType.objects.filter(Q(code__icontains=q) | Q(name__icontains=q))
def format_result(self,ftype): def format_result(self,ftype):
""" the search results display in the dropdown menu. may contain html and multiple-lines. will remove any | """ """ the search results display in the dropdown menu. may contain html and multiple-lines. will remove any | """
return u"%s: %s" % (ftype.code, ftype.name,) return u"%s: %s" % (ftype.code, ftype.name,)
def format_item(self,contact): def format_item(self,ftype):
""" the display of a currently selected object in the area below the search box. html is OK """ """ the display of a currently selected object in the area below the search box. html is OK """
return unicode(contact) return unicode(ftype)
def get_objects(self,ids): def get_objects(self,ids):
""" given a list of ids, return the objects ordered as you would like them on the admin page. """ given a list of ids, return the objects ordered as you would like them on the admin page.