muccg / django-useraudit

Django user audit utilities like logging user log in, disabling access when password expires or user is inactive.
BSD 3-Clause "New" or "Revised" License
34 stars 18 forks source link

Migrating to use Django >= 4.x #44

Open dhiashalabi opened 2 years ago

dhiashalabi commented 2 years ago

This package does not work with Django >= 4.x.

Awmusic12635 commented 2 years ago

I have noticed the same issue. Starting the app leads to

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Users/awacker/.pyenv/versions/3.8.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/Users/awacker/.pyenv/versions/3.8.8/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/core/management/__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/django/apps/config.py", line 304, in import_models
    self.models_module = import_module(models_module_name)
  File "/Users/awacker/.pyenv/versions/3.8.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/useraudit/models.py", line 6, in <module>
    from .signals import password_has_expired, account_has_expired, login_failure_limit_reached
  File "/Users/awacker/.pyenv/versions/lms-3-8-8/lib/python3.8/site-packages/useraudit/signals.py", line 3, in <module>
    password_will_expire_warning = Signal(providing_args=["user", "days_left"])
TypeError: __init__() got an unexpected keyword argument 'providing_args'

https://docs.djangoproject.com/en/4.0/releases/4.0/#features-removed-in-4-0 mentions that providing_args named argument for Signal is no longer supported.

wail-asad commented 2 years ago

I have the same issue

spapas commented 2 years ago

Hello @muccg any idea when this will be fixed?

dhiashalabi commented 2 years ago

Hello @muccg any idea when this will be fixed?

As soon as possible I hope.

Awmusic12635 commented 2 years ago

I made this awhile ago, but feel free to use my pull request / branch for any of you that need it working until it gets merged in. https://github.com/muccg/django-useraudit/pull/45 . I've been running it since I made it without issue.