Skip to content Skip to sidebar Skip to footer

Django-countries: Person() Takes Exactly 1 Argument (0 Given)

I am trying to use the django-countries application with Django for the first time but I am getting this error which has me confused. TypeError at /survey/ Person() takes exactly

Solution 1:

Your model and your view has the same name so you have a namespace conflict. Change the name of the view and it will be fine.

The error says you need to pass an argument because you have redefined Person to be a function with 1 argument (request). Something like this should work (adapt your urls.py):

def create_survey(request): 
     # ...

Solution 2:

You have Person the model class and Person the function. Name one of them something else (and functions should not start with capitals anyway).

Looks like Person the function requires a request parameter, which you're not passing in. I think you mean to be using Person the class, but the redefinition is confusing things.


Post a Comment for "Django-countries: Person() Takes Exactly 1 Argument (0 Given)"