sshwsfc / xadmin

Drop-in replacement of Django admin comes with lots of goodies, fully extensible with plugin support, pretty UI based on Twitter Bootstrap.
http://www.xadmin.io
BSD 3-Clause "New" or "Revised" License
4.76k stars 1.41k forks source link

TypeError: __init__() takes 1 positional argument but 6 were given #580

Open Cunwo opened 6 years ago

Cunwo commented 6 years ago

"D:\soft\PyCharm 2018.1.2\bin\runnerw.exe" E:\workspace\python\PycharmProjects\MxShop\venv\Scripts\python.exe "D:\soft\PyCharm 2018.1.2\helpers\pycharm\django_manage.py" makemigrations E:/workspace/python/PycharmProjects/MxShop Tracking file by folder pattern: migrations Traceback (most recent call last): File "D:\soft\PyCharm 2018.1.2\helpers\pycharm\django_manage.py", line 52, in run_command() File "D:\soft\PyCharm 2018.1.2\helpers\pycharm\django_manage.py", line 46, in run_command run_module(manage_file, None, 'main', True) File "D:\develop\python3.6.5\Lib\runpy.py", line 205, in run_module return _run_module_code(code, init_globals, run_name, mod_spec) File "D:\develop\python3.6.5\Lib\runpy.py", line 96, in _run_module_code mod_name, mod_spec, pkg_name, script_name) File "D:\develop\python3.6.5\Lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "E:/workspace/python/PycharmProjects/MxShop\manage.py", line 15, in execute_from_command_line(sys.argv) File "E:\workspace\python\Envs\VueShop\lib\site-packages\django\core\management__init.py", line 371, in execute_from_command_line utility.execute() File "E:\workspace\python\Envs\VueShop\lib\site-packages\django\core\management__init.py", line 347, in execute django.setup() File "E:\workspace\python\Envs\VueShop\lib\site-packages\django__init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "E:\workspace\python\Envs\VueShop\lib\site-packages\django\apps\registry.py", line 120, in populate app_config.ready() File "E:\workspace\python\PycharmProjects\MxShop\extra_apps\xadmin\apps.py", line 14, in ready self.module.autodiscover() File "E:\workspace\python\PycharmProjects\MxShop\extra_apps\xadmin\init__.py", line 29, in autodiscover from xadmin.views import register_builtin_views File "E:\workspace\python\PycharmProjects\MxShop\extra_apps\xadmin\views\init__.py", line 10, in from .dashboard import Dashboard, BaseWidget, widget_manager, ModelDashboard File "E:\workspace\python\PycharmProjects\MxShop\extra_apps\xadmin\views\dashboard.py", line 316, in class ModelBaseWidget(BaseWidget): File "E:\workspace\python\PycharmProjects\MxShop\extraapps\xadmin\views\dashboard.py", line 321, in ModelBaseWidget model = ModelChoiceField(label=(u'Target Model'), widget=exwidgets.AdminSelectWidget) File "E:\workspace\python\PycharmProjects\MxShop\extra_apps\xadmin\views\dashboard.py", line 285, in init *args, **kwargs) TypeError: init__() takes 1 positional argument but 6 were given

Process finished with exit code 1

rotateX commented 6 years ago

change forms.Field.__init__(self, required, widget, label, initial, help_text, *args, **kwargs) to forms.Field.__init__(self)

krismbrg commented 6 years ago

code does not work with django 2.1, lots of issues

iwannarocks commented 5 years ago

change

forms.Field.init(self, required, widget, label, initial, help_text, *args, **kwargs)

to

forms.Field.init(self, required=required, widget=widget, label=label, initial=initial, help_text=help_text, **kwargs)

because------------------ django 2.1 form filed param use *

def __init__(self, *, required=True, widget=None, label=None, initial=None,
             help_text='', error_messages=None, show_hidden_initial=False,
             validators=(), localize=False, disabled=False, label_suffix=None):
TorrezMN commented 5 years ago

I don't know if it still works, but I had the same problem with a "modelform" of Django and I solved it by changing the name of the form. It turns out that I had a "New_Exercise" view and the form was called "New_Exercise" ... I don't know why but I conclude that the subject was a "name conflict" issue. I changed the name of the form and everything worked perfect. Well just one opinion, I hope it helps ...