jazzband / django-user-sessions

Extend Django sessions with a foreign key back to the user, allowing enumerating all user's sessions.
https://pypi.python.org/pypi/django-user-sessions
MIT License
628 stars 128 forks source link

Django 4.0 Support #142

Closed tzetter closed 2 years ago

tzetter commented 2 years ago

Description

This PR simply changes the inherited classes of the SessionDeleteView to behave the same way on Django 4.0 as on older versions. The tests were also changed to both run on Django 3.2 and Django 4.0. The tests now also run on Python 3.10 for supported Django versions.

Motivation and Context

Django 3.2 and 4.0 will soon be the only officially supported Django versions. Django recommends running the latest supported Python version, which currently is 3.10.

As context, the DeleteView also inherits FormMixin in Django 4.0 (detailed here: https://docs.djangoproject.com/en/4.0/releases/4.0/#generic-views), which caused the SessionDeleteView not to work correctly.

How Has This Been Tested?

The automated tests have been run. I manually checked that the library worked with Django 4.0.2.

Types of changes

Checklist:

Jenselme commented 2 years ago

Any update on this?

codecov[bot] commented 2 years ago

Codecov Report

Merging #142 (1c196f7) into master (6adcff7) will increase coverage by 0.01%. The diff coverage is 100.00%.

:exclamation: Current head 1c196f7 differs from pull request most recent head 7730fbe. Consider uploading reports for the commit 7730fbe to get more accurate results

@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
+ Coverage   91.85%   91.86%   +0.01%     
==========================================
  Files          16       16              
  Lines         675      676       +1     
  Branches       66       68       +2     
==========================================
+ Hits          620      621       +1     
  Misses         45       45              
  Partials       10       10              
Impacted Files Coverage Δ
user_sessions/views.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6adcff7...7730fbe. Read the comment docs.

dopry commented 2 years ago

@tzetter I just rebased your branch and added a commit to update the example to work with Django 4. Assuming everything still passes, unless you have anything else to add, LGTM.