Hi everybody !
I have two tables on my database : one for the products (named
Product) and one for my clients (name Client).
In Client, there is a row named 'products' where I put all the client
products with a list and a dictionnary.
For exemple : list = ["prod1": {"name"="product1", "price"=2},
"prod2":{"name"="product2", "price"=3}]
I want to autocomplete a field with Jquery with the table Product.
So I wrote (ok ! copy :p) this function :
def lookup_product(request, name):
# Default return list
results = []
if request.method == "GET":
if request.GET.has_key(u'query'):
value = request.GET[u'query']
# Ignore queries shorter than length 3
if len(value) > 2:
model_results =
Product.objects.filter(name__icontains=value)
results = [ x.name for x in model_results ]
json = simplejson.dumps(results)
return HttpResponse(json, mimetype='application/json')
However, I want to filter the table Product with all the client
products.
Does anybody have an idea to do it ?
I thought on something like that : add in filter "name is present on
list" where list is the client products list. What's your opinion ?
Thanks
PEP
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.