vvangelovski / django-audit-log

Audit log for your Django models
Other
232 stars 93 forks source link

Django 2.0 Support #52

Open bobort opened 6 years ago

bobort commented 6 years ago

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

decibyte commented 6 years ago

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 :)

myourshaw commented 6 years ago

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.
sdreher commented 6 years ago

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.

dakab1 commented 6 years ago

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

MHzarini commented 6 years ago

come on guys, i need this

JanMalte commented 6 years ago

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

PeterSchwarzHPI commented 6 years ago

Any news over here?

Fhall21 commented 6 years ago

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?

pawisoon commented 5 years ago

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

decibyte commented 5 years ago

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.

AbhiRawat95 commented 5 years ago

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

pakal commented 5 years ago

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