On Fri, Oct 11, 2013 at 4:06 PM, Leonardo Giordani <giordani.leona...@gmail.com> wrote: > I think that you have to perform a query for each Code, extracting the list > of Word matching that Code and then merging all the lists.
Exactly! > Since I don't know your models, I'll give you some general code, let me know > if you understand how to implement it exactly on your models. Here are these two models: http://tny.cz/82158e83 <snip> > This is the basic algorithm. You can then make all sorts of Python magic > tricks to shorten it or make it faster, but if you are not dealing with > billions of data I do suggest you to keep it simple and readable. Ok. > If you need to have each element in B appear just one time (uniqueness) just > perform a B = set(B) at the end. Ok. > Let me know if it works. =) Yes it will work! But after extending list B, I want to search the elements of list B from UserProfile table. Here the word can be anywhere and can be more than one times. Also two words in list B can be in same column. Here also the results must be unique. Also how to get the output in a template? The tuples containing elements of list B from UserProfile table are to be displayed in that template. Thanks ^_^ -- Kamaljeet Kaur -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAP8Q%2BxidZD%2B6mo2z4POabcX_WBFPvEk%3D%3Dg%2BOPNET6u0SYmM%3DkQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.