Hi James, On 8/9/07, james_027 <[EMAIL PROTECTED]> wrote: > > hi, > > I am trying to put a page list for a search result. So far here's what > I've try by using the django.views.generic.list_detail.object_list and > the pagination tag (http://code.djangoproject.com/wiki/PaginatorTag) > and later found out that it won't meet my needs. > > def search_employee(request): > if not request.GET: > return render_to_response('search_employee.htm') > else: > params = request.GET['name'].split() > employees = Employee.objects.all() > for p in params: > employees = employees.filter(Q(firstname = p) | Q(lastname > = p)) > return object_list(request, employees, paginate_by=3, > template_name='search_employee_result.htm', > template_object_name='employee') > > This won't work because when you try to select other page the > query_set from previous is lost ... I am thinking off passing the > request.GET to the object_list's extra_context argument, then edit the > pagination tag that will provide link constrcuted from the > extra_context? > > Or is there a better solution or existing solution?
Do you mean that the filter works on the first page but is lost when you go to another page? If yes: I save my filter in a session and filter on each page using that filter values (the values that were given to the input fields of the filter form). I don't know whether this is the right way (tm) but it works for me. :-) > Thanks > james Greetings Kai --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---