I have an error:

Exception Type: ImproperlyConfigured at /search/
Exception Value: Error while importing URLconf 'mysite.urls': 'tuple'
object is not callable

Here're the files:

Module: mysite.books.views
---------------------------------------

from django.db.models import Q
from django.shortcuts import render_to_response
from mysite.books.models import Book

def search(request):
    query = request.GET.get('q', '')
    if query:
        qset = (
            Q(title__icontains=query) |
            Q(authors__first_name__icontains=query) |
            Q(authors__last_name__icontains=query)
        )
        results = Book.objects.filter(qset).distinct()
    else:
        results = []
    return render_to_response("books/search.html", {
        "results": results,
        "query": query
    })
----------------------------------------------------------------------------

Module: mysite.url
-------------------------

from django.conf.urls.defaults import *
from mysite.views import current_datetime, hours_ahead

urlpatterns = patterns('',
    (r'^time/$', current_datetime),
    (r'^time/plus/(\d{1,2})/$', hours_ahead),
    (r'^search/$', 'mysite.books.views.search')

    # Uncomment this for admin:
     (r'^admin/', include('django.contrib.admin.urls')),
)
----------------------------------------------------------------------------

What's the solution?

Thanks, Mikey3D
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to