django-audit-log icon indicating copy to clipboard operation
django-audit-log copied to clipboard

Django 2.0 Support

Open bobort opened this issue 7 years ago • 12 comments

ForeignKeys require an on_delete argument. Therefore, CreatingUserField doesn't work. Please update for Django 2.0 support.

bobort avatar Dec 03 '17 19:12 bobort

I'm currently working on 2.0 support (PR #55), but I can't tell how far I am. I keep running into new things that doesn't work. Also, I'm not sure we'll be able to get my PR merged in and pushed to PyPI. But I'm focusing on fixing the code first :)

decibyte avatar Dec 13 '17 14:12 decibyte

I, too, am having problems with 2.0 on a large application we are trying to modernize. I get "missing 1 required positional argument: 'on_delete'" on startup.

[yoursham@cmoco-sys-dev-web cmoco-sys_project]$ ${SINGULARITY_EXEC} gunicorn config.wsgi:application;
[2017-12-20 09:26:37 -0700] [6398] [INFO] Starting gunicorn 19.7.1
[2017-12-20 09:26:37 -0700] [6398] [INFO] Listening at: http://127.0.0.1:8000 (6398)
[2017-12-20 09:26:37 -0700] [6398] [INFO] Using worker: sync
[2017-12-20 09:26:37 -0700] [6404] [INFO] Booting worker with pid: 6404
[2017-12-20 09:26:38 -0700] [6404] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 578, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 126, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/workers/base.py", line 135, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
    __import__(module)
  File "/home/cmoco/cmoco-sys_project/config/wsgi.py", line 14, in <module>
    application = get_wsgi_application()
  File "/usr/local/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
    django.setup(set_prefix=False)
  File "/usr/local/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python3.6/site-packages/django/apps/registry.py", line 112, in populate
    app_config.import_models()
  File "/usr/local/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/home/cmoco/cmoco-sys_project/lims/userprofiles/models.py", line 8, in <module>
    from audit_log.models import AuthStampedModel
  File "/usr/local/lib/python3.6/site-packages/audit_log/models/__init__.py", line 5, in <module>
    class AuthStampedModel(Model):
  File "/usr/local/lib/python3.6/site-packages/audit_log/models/__init__.py", line 10, in AuthStampedModel
    created_by = CreatingUserField(verbose_name = _("created by"), related_name = "created_%(app_label)s_%(class)s_set")
  File "/usr/local/lib/python3.6/site-packages/audit_log/models/fields.py", line 14, in __init__
    super(LastUserField, self).__init__(to = to, null = null, editable = editable, **kwargs)
TypeError: __init__() missing 1 required positional argument: 'on_delete'
[2017-12-20 09:26:38 -0700] [6404] [INFO] Worker exiting (pid: 6404)
[2017-12-20 09:26:38 -0700] [6398] [INFO] Shutting down: Master
[2017-12-20 09:26:38 -0700] [6398] [INFO] Reason: Worker failed to boot.

myourshaw avatar Dec 20 '17 17:12 myourshaw

I'm also looking for Django 2.0 support. This https://github.com/Atomidata/django-audit-log/pull/55 seems to take care of the issues. Definitely would appreciate if this were merged and updated on pypi.

sdreher avatar Feb 06 '18 20:02 sdreher

Hi Is there any solution to this in Django version 2.0 yet?

dakab1 avatar Feb 21 '18 18:02 dakab1

come on guys, i need this

MHzarini avatar Mar 10 '18 14:03 MHzarini

@decibyte @vvangelovski Which issues are still open and prevent a release with Django 2.0 support?

JanMalte avatar Mar 23 '18 13:03 JanMalte

Any news over here?

PeterSchwarzHPI avatar May 26 '18 19:05 PeterSchwarzHPI

Hey there! Still getting the error: TypeError: __initi__() missing 1 required positional argument: 'on_delete from line 14 in fields.py: super(LastUserField, self).__init__(to = to, null = null, editable = editable, ** kwargs) Is there any news on the progress?

Fhall21 avatar Jul 27 '18 23:07 Fhall21

HI there! I have same issue on Django 2.1.5 TypeError: __init__() missing 1 required positional argument: 'on_delete'

pawisoon avatar Jan 25 '19 11:01 pawisoon

For anyone running into this problem: I'd suggest installing from GitHub instead of PyPI, untill @vvangelovski finds the time to push a new version to PyPI.

decibyte avatar Jan 25 '19 11:01 decibyte

@decibyte any update on this issue? Any update on when it will be pushed to PyPI.

AbhiRawat95 avatar May 24 '19 07:05 AbhiRawat95

For people who need urgent django compatibility, I shamelessly advise to use https://github.com/pakal/django-compat-patcher until all dependencies are updated to Django2

pakal avatar Jun 03 '19 08:06 pakal