[Fixed]-Getting error as "TypeError at /add_follow/1/ __init__() takes 1 positional argument but 2 were given"

1👍

It’s hard to know what’s wrong from the exception message alone. But when you are using class based views, you must call the as_view() function to use them in your url router.

https://docs.djangoproject.com/en/1.11/topics/class-based-views/#subclassing-generic-views

So change all the cbv routes (but not function views) in your urls.py

# BAD
url(r'^$', imagec_views.ListaFollow, name="lista_follow"),

# CORRECT
url(r'^$', imagec_views.ListaFollow.as_view(), name="lista_follow"),

Leave a comment