Open Cunwo opened 6 years ago
change
forms.Field.__init__(self, required, widget, label, initial, help_text, *args, **kwargs)
to
forms.Field.__init__(self)
code does not work with django 2.1, lots of issues
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):
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 ...
"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