I'm pretty new to Django so I apologize if this is an elementary and obvious question. I did look through the docs but I'm still confused as to how to get this working.
I'll try to describe what my website does with books as an example. Basically I have a large database with information about books. I want to be able to filter books that meet certain criteria and then display them on the website. The problem I'm having is that the list of books I want to display is dynamic and I don't know how to iterate this in the template. Example: keywords are python, django. keywords = ["python", "django"] In the view.py I loop through the keywords. for keyword in keywords: keyword = books.objects.get(headline__icontains=keyword) Then I pass each keyword as a dictionary and also the list of keywords. Now in the template I try to do this for book in keywords for bookinfo in book Here's the part where I get an error and I'm not sure how to get around this. It works fine if I use the actual name of the keyword for example: for bookinfo in python The problem is the list could change and I don't want to hard code the name into the template because then I would have to change it each time I add or change a keyword Thanks for the help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---