Opened 9 years ago

Closed 9 years ago

#23810 closed Bug (needsinfo)

Passing 'start' from django url gives error “start() takes exactly 2 arguments (1 given) ”

Reported by: yogeshdmca Owned by: yogesh
Component: Core (URLs) Version: 1.6
Severity: Normal Keywords: django-url
Cc: yogeshdmca Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

unfortunately i am getting a unexpected error in Django. I have a this urls :

urlpatterns += patterns('ads.search',
        url(r'^getsubcategories/$', 'getsubcategories', name="getsubcategories"),
        url(r'^anuncios/([\w\-]+)/$', 'anuncios_search', name="anuncios_search"),
)

When I am going to call url "anuncios_search" this will work for all search patterns accept "/anuncios/start/", please see below for working urls:

examples:

1) /anuncios/avc/ : this works.

2) /anuncios/finds/: this works .

3) /anuncios/start-day/: this works .

4) /anuncios/starts/: this works .

5) /anuncios/start/: this url throwing me error :

Internal Server Error: /anuncios/start/
Traceback (most recent call last):
  File "/home/yogesh/ENV/munda/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
TypeError: start() takes exactly 2 arguments (1 given)
[13/Nov/2014 05:36:57] "GET /anuncios/start/ HTTP/1.1" 500 11496

my views.py is :

def anuncios_search(request,search_text=None):
    """
    This method for home page search, for acept contactos category
    """
    if search_text:
        search_text_list = [i for i in search_text.split("-") if len(i)>2]
    else:
        search_text_list=[]

    ads = Ad.objects.exclude(subcategory__category__adult=True,user__is_active=True).order_by('-active','-republishDate')
    if search_text_list:
        ads = ads.filter(
            reduce(lambda x, y: x | y, [Q(title__icontains=word) for word in search_text_list])|
            reduce(lambda x, y: x | y, [Q(description__icontains=word) for word in search_text_list])
            ).order_by('-active','-republishDate')

    current_filters= {'current_category':None,'ads':ads_paginator(request,ads)}
    current_filters['search_text'] = search_text and " ".join(search_text.split("-")) or None
    current_filters['search_text_list'] = search_text_list and search_text_list or None
    return render(request,'search/search.html',current_filters)

Please help me to resolve this bug.
Thanks in advance

Change History (3)

comment:1 by Claude Paroz, 9 years ago

Resolution: worksforme
Status: newclosed

Please, try first wiki:TicketClosingReasons/UseSupportChannels and open a ticket only if your problem is due to a bug in Django itself.

comment:2 by yogeshdmca, 9 years ago

Cc: yogeshdmca added
Resolution: worksforme
Status: closednew

Hi, issue i am getting that produce by django itself, that is not a mistake of any third party app or not my project code. so please take needful action.

for example: you just create a demo project and give url like me. you will get same issue.

comment:3 by Tim Graham, 9 years ago

Resolution: needsinfo
Status: newclosed

You haven't provided sufficient details to suggest that this is a bug in Django. If you can provide a failing test for Django's test suite, that would work. Or use the support channels as Claude suggested to get help. Thanks!

Note: See TracTickets for help on using tickets.
Back to Top