Hi,
I done a little search function in my app, it isn't working at all.
Now I don't know if it's problem with query, views or something else.

My code

# views.py

from django.shortcuts import render_to_response
from django.db.models import Q
from web_aplikacje.produkty.models import Produkt, Producent

def search(request):
    if 'q' in request.GET:
        term = request.GET['q']
        prod_list =
Producent.objects.filter(Q(nazwa_producenta__contains=term))
        heading = "Wyniki wyszukiwania"
    return render_to_response("producent_list.html", locals())

#urls.py

from django.conf.urls.defaults import *
from web_aplikacje.produkty.models import Produkt, Producent

info = { 'queryset' : Producent.objects.all(),
         'template_object_name': 'prod',
}

urlpatterns = patterns('django.views.generic.list_detail',
    url(r'^(?P<slug>[-\w]+)/$', 'object_detail', info, name="link-
prod"),
    url(r'^$','object_list', info, name="link-home"),

)

urlpatterns += patterns('web_aplikacje.produkty.views',
   url(r'^search/$', 'search', name="link-search"),
)

Anything I type in search field I get
'Page no found (404)'
No producent found matching the query

Query write in shell work for many diffrent terms, so this is a
problem with display results or  I don't know.

Any suggestions for this ?

-- 
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