Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: formfield_for_dbfield() takes 3 positional arguments but 4 were given #5

Open
jayvdb opened this issue Jun 30, 2020 · 1 comment

Comments

@jayvdb
Copy link

jayvdb commented Jun 30, 2020

Running smoke tests with this added, and the following comes out many times for lots of our models.
It is running on Django 3.0 on Python 3.8
I can try to narrow it down, but it is likely self explainatory.

ERROR: test_add_view (cookiecutter.tests.test_admin_smoke.AdminSiteSmokeTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/django_admin_smoke_tests/tests.py", line 31, in test_deco
    fn(self, model, model_admin)
  File "/usr/lib/python3.8/site-packages/django_admin_smoke_tests/tests.py", line 265, in test_add_view
    response = model_admin.add_view(request)
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1641, in add_view
    return self.changeform_view(request, None, form_url, extra_context)
  File "/usr/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper
    return bound_method(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1523, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1557, in _changeform_view
    ModelForm = self.get_form(request, obj, change=not add)
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 669, in get_form
    fields = flatten_fieldsets(self.get_fieldsets(request, obj))
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 328, in get_fieldsets
    return [(None, {'fields': self.get_fields(request, obj)})]
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 319, in get_fields
    form = self._get_form_for_get_fields(request, obj)
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 659, in _get_form_for_get_fields
    return self.get_form(request, obj, fields=None)
  File "/usr/lib/python3.8/site-packages/django/contrib/admin/options.py", line 702, in get_form
    return modelform_factory(self.model, **defaults)
  File "/usr/lib/python3.8/site-packages/django/forms/models.py", line 554, in modelform_factory
    return type(form)(class_name, (form,), form_class_attrs)
  File "/usr/lib/python3.8/site-packages/django/forms/models.py", line 252, in __new__
    fields = fields_for_model(
  File "/usr/lib/python3.8/site-packages/django/forms/models.py", line 178, in fields_for_model
    formfield = formfield_callback(f, **kwargs)
  File "/usr/lib/python3.8/site-packages/django/contrib/gis/admin/options.py", line 63, in formfield_for_dbfield
    return super().formfield_for_dbfield(db_field, request, **kwargs)
  File "/usr/lib/python3.8/site-packages/monkeybiz/__init__.py", line 89, in wrapper
    return func(original_callable, *args, **kwargs)
TypeError: formfield_for_dbfield() takes 3 positional arguments but 4 were given

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/django_admin_smoke_tests/tests.py", line 50, in test_deco
    six.raise_from(ModelAdminCheckException(
  File "<string>", line 3, in raise_from
django_admin_smoke_tests.tests.ModelAdminCheckException: Above exception occured while running test 'test_add_view' on modeladmin area.AreaTemplateAdmin (AreaTemplate)
@dakrauth
Copy link
Contributor

@jayvdb We've updated the code to super Django >= 2.2. If that does not fix things, please point to your repo/branch, I was unable to find it in your fork of django-admin-smoke-tests in a super quick search.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants