Skip to content
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

Add urlconf param to HttpRequest #2239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bigfootjon
Copy link
Contributor

I have made things!

Ref the docs: https://docs.djangoproject.com/en/5.0/topics/http/urls/#how-django-processes-a-request

Django determines the root URLconf module to use. Ordinarily, this is the value of the ROOT_URLCONF setting, but if the incoming HttpRequest object has a urlconf attribute (set by middleware), its value will be used in place of the ROOT_URLCONF setting.

Related issues

N/A

Ref the docs: https://docs.djangoproject.com/en/5.0/topics/http/urls/#how-django-processes-a-request

> Django determines the root URLconf module to use. Ordinarily, this is the value of the ROOT_URLCONF setting, but if the incoming HttpRequest object has a urlconf attribute (set by middleware), its value will be used in place of the ROOT_URLCONF setting.
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

@ngnpope
Copy link
Contributor

ngnpope commented Jun 27, 2024

This is documented here:

https://docs.djangoproject.com/en/stable/ref/request-response/#attributes-set-by-application-code

I would suggest adding all of these and grouping them together with a link to the documentation.

Similarly, it's probably worth checking these and grouping them together also:

https://docs.djangoproject.com/en/stable/ref/request-response/#attributes-set-by-middleware

@sobolevn
Copy link
Member

sobolevn commented Jun 27, 2024

what about adding these properties as self.urlconf = None to HttpRequest.__init__?

@adamchainz
Copy link
Contributor

what about adding these properties as self.urlconf = None to HttpRequest.__init__?

None isn't a valid value - Django uses hasattr() to check for them...

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

Successfully merging this pull request may close these issues.

4 participants