Skip to content

Support for request-level urlconf overrides #1488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2021

Conversation

NielkS
Copy link
Contributor

@NielkS NielkS commented Jul 28, 2021

Middlewares can override the default urlconf per request by setting a "urlconf" attribute to the inbound HttpRequest instance
(doc: https://docs.djangoproject.com/en/3.2/ref/request-response/#django.http.HttpRequest.urlconf )
This change adds support for this kind of override

Copy link
Member

@tim-schilling tim-schilling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @NielkS for the PR! Can you add a test that verifies this functionality? Please also add a mention of this in the docs/changes.rst

@codecov
Copy link

codecov bot commented Jul 29, 2021

Codecov Report

Merging #1488 (75dfe55) into main (15a581d) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 75dfe55 differs from pull request most recent head 9a232bc. Consider uploading reports for the commit 9a232bc to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1488   +/-   ##
=======================================
  Coverage   86.58%   86.58%           
=======================================
  Files          35       35           
  Lines        1864     1864           
  Branches      262      262           
=======================================
  Hits         1614     1614           
  Misses        178      178           
  Partials       72       72           
Impacted Files Coverage Δ
debug_toolbar/toolbar.py 92.04% <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 15a581d...9a232bc. Read the comment docs.

@tim-schilling
Copy link
Member

Ah, looks like the linter failed. You can run that locally with make style

NielkS and others added 2 commits August 9, 2021 20:21
Middlewares can override the default urlconf per request by setting a "urlconf" attribute to the inbound HttpRequest instance
(doc: https://docs.djangoproject.com/en/3.2/ref/request-response/#django.http.HttpRequest.urlconf )
This change adds support for this kind of override
Update docs for urlconf override per request.
@tim-schilling
Copy link
Member

Rebased on main, added a test and updated changes documentation. Merging after CI passes.

@tim-schilling tim-schilling merged commit f4c263a into django-commons:main Aug 10, 2021
@tim-schilling
Copy link
Member

@NielkS thank you for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants