Hi, I have form on a search page called SearchForm where the user selects items to search. The rest part creates a URI which appears as below from the selected items to search.
http://archive/ephemera/searchresult/?choose_collection=Macmillan&user_input=GuitarBuilder&choose_item=title I'm trying to write a classview in views.py to get the URI parameters, then fashion a query to place those in an object_list for viewing in a search results template. views.py class SearchResultsView(django.views.generic.ListView): template_name = 'ephemera/searchresults.html' model = Item #my model class def get_queryset(self, **kwargs): form = SearchForm() choose_collection = self.request.GET.get('choose_collection') user_input = self.request.GET.get('user_input') choose_item = self.request.GET.get('choose_item') object_list = self.model.objects.filter(collection__icontains = choose_collection).filter(choose_item__icontains = user_input) #XXX return object_list I can't seem to figure out how to pass the choose_item get variable to the filter. Django complains cannot resolve keyword 'choose_item' into field. The correct field is 'title' but I won't know that until the user selects one of the choices from the form pull down menu. The following query works fine directly on sqlite, but I can't seem to figure out how to do it in the class view. select * from ephemera_item where collection = 'MACMILLAN' AND title = 'Guitar Builder'; Could be my basic approach is bad too, because I'm only just starting out with this. Thank you for any advice. Regards, Bob -- 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 https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALWZDaPAr0VYra-HazcwCXcvmh%3DYY9O9m1e6oKBTrxF9ouRz6w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.