django-user-sessions icon indicating copy to clipboard operation
django-user-sessions copied to clipboard

Enable configurable root URL paths

Open blag opened this issue 2 years ago • 2 comments

Allow this app's URLConf to be parented in more places than just /account/.

Description

This PR removes the /account/ prefix from this app's URLConf, allowing developers to choose for themselves what URL prefixes they would like.

To ensure backwards compatibility, I adjusted the root URLConfs in the tests project and the example project to still use the /account/ prefix. Furthermore, I also adjusted the documentation to instruct users to do the same:

...
urls = [
    path('account/', include('user_sessions.urls', namespace='user_sessions')),
]

Advanced users should hopefully understand that they can adjust that prefix to whatever they'd like, and beginner users will simply mirror the documentation and continue with the previous behavior.

Motivation and Context

The previously behavior isn't necessarily congruous with django-allauth, which uses /accounts/, and other users might want different prefixes altogether.

Closes #43 and #47.

How Has This Been Tested?

I updated the URLConf in the tests project and relied on GHA tests.

Screenshots (if appropriate):

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [x] I have updated the documentation accordingly.
  • [x] I have added tests to cover my changes. - N/A
  • [ ] All new and existing tests passed.

Assuming that tests for Python 3.7+Django 3.2 pass (currently running), test results for this branch have not changed from test results for master.

blag avatar Sep 18 '23 20:09 blag

Codecov Report

Merging #164 (7538ae0) into master (eb315b2) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #164   +/-   ##
=======================================
  Coverage   97.67%   97.67%           
=======================================
  Files          17       17           
  Lines         689      689           
  Branches       56       56           
=======================================
  Hits          673      673           
  Misses         10       10           
  Partials        6        6           
Files Coverage Δ
tests/urls.py 100.00% <ø> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

codecov[bot] avatar Sep 18 '23 20:09 codecov[bot]

Needs rebase

WhyNotHugo avatar Oct 16 '23 07:10 WhyNotHugo