I want to allow a user to search for a value and return the results
using the object_list generic view. How can I get this working?

business_search.html:
{% block content %}
        <form action="" method="get">
                Business name:<input type="text" name="business" />
                <input type="submit" value="Search" />
{% endblock content %}

urls.py:
(r'^?business=(?P<business_name>\w+)/','businessnamesearch_view'),

views.py: (field in models.py to search on is named business)
def businessnamesearch_view(request, business_name):
    business = Business.objects.filter
(business__icontains=business_name)
    return object_list(request, queryset=business)

I have a template, business_list.html that works already.

I get the error:
Request Method:         GET
Request URL:    http://127.0.0.1:8000/business/?business=AB
Exception Type:         error
Exception Value:        nothing to repeat

--

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=en.


Reply via email to