chrisspen / django-chroniker

Easily control cron jobs through Django's admin.
138 stars 70 forks source link

TypeError error in logs #192

Open SubrahmanyaG opened 4 years ago

SubrahmanyaG commented 4 years ago

When i m accessing the logs i m getting the error formfield_for_dbfield() missing 1 required positional argument: 'request'

when i debugged the issue it is found out to be the difference in chroniker and django admin

chroniker method

    def formfield_for_dbfield(self, db_field, **kwargs):
        request = kwargs.pop("request", None)

django 2.15.x method

    def formfield_for_dbfield(self, db_field, request, **kwargs):
        """
        Hook for specifying the form Field instance for a given database Field

Can you please suggest me the solution to this? or on which django version this issue woun't be there

chrisspen commented 4 years ago

Could you post your entire traceback and the django-chroniker version you're using?

SubrahmanyaG commented 4 years ago

sure @chrisspen here is the traceback

Internal Server Error: /admin/chroniker/log/2452/change/
Traceback (most recent call last):
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/core/handlers/base.py", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/contrib/admin/options.py", line 604, in wrapper
    return self.admin_site.admin_view(view)(*args, **kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/contrib/admin/sites.py", line 223, in inner
    return view(request, *args, **kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1651, in change_view
    return self.changeform_view(request, object_id, form_url, extra_context)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/utils/decorators.py", line 45, in _wrapper
    return bound_method(*args, **kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1532, in changeform_view
    return self._changeform_view(request, object_id, form_url, extra_context)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/contrib/admin/options.py", line 1565, in _changeform_view
    ModelForm = self.get_form(request, obj, change=not add)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/contrib/admin/options.py", line 703, in get_form
    return modelform_factory(self.model, **defaults)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/forms/models.py", line 551, in modelform_factory
    return type(form)(class_name, (form,), form_class_attrs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/forms/models.py", line 256, in __new__
    apply_limit_choices_to=False,
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/django/forms/models.py", line 176, in fields_for_model
    formfield = formfield_callback(f, **kwargs)
  File "/home/hasher/Apps/irident_ai/venv3/lib/python3.6/site-packages/chroniker/admin.py", line 569, in formfield_for_dbfield
    return super(LogAdmin, self).formfield_for_dbfield(db_field, **kwargs)
TypeError: formfield_for_dbfield() missing 1 required positional argument: 'request'
[27/May/2020 16:27:57] "GET /admin/chroniker/log/2452/change/ HTTP/1.1" 500 150514

Django and chroniker versions

Django==2.1.15 django-chroniker==1.0.19

chrisspen commented 4 years ago

Looks like your version of django-chroniker is out of date. I can't reproduce the issue on master branch. Could you try upgrading?