Opened 5 years ago

Last modified 5 years ago

#29664 closed Cleanup/optimization

Need Proper error handling for CBV in urls. — at Initial Version

Reported by: Amar Owned by: emiamar@…
Component: Core (URLs) Version: 2.1
Severity: Normal Keywords:
Cc: emiamar@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When in if one misses to call as_view() (Example shown below) method django throws weird error. Need better way of handling error

Incorrect definition

urlpatterns = [
    path('hello/', HelloView)

Correct definition

urlpatterns = [
    path('hello/', HelloView.as_view())


TypeError at /hello/

__init__() takes 1 positional argument but 2 were given

Request Method: 	GET
Request URL: 	http://localhost:8000/hello/
Django Version: 	2.0.7
Exception Type: 	TypeError
Exception Value: 	

__init__() takes 1 positional argument but 2 were given

Exception Location: 	/home/amar/.virtualenvs/djmongo/lib/python3.6/site-packages/django/core/handlers/ in _get_response, line 126

Change History (0)

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