Is it possible to pass vars to filters rather than hard coding the field name, something like this:
def search(request): query = request.GET.get('q', '') bits = request.GET.get('models', '').partition('.') model_name = bits[0] field_name = bits[2] model_type = ContentType.objects.get(app_label="blog", model=model_name) model_class = model_type.model_class() results = [] if query: results = model_class.objects.filter (field_name__icontains=query) return render_to_response('search/search.html', { 'query': query, 'results': results }) Thanks, J -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=.