typeddjango / django-stubs

PEP-484 stubs for Django
MIT License
1.52k stars 425 forks source link

Add urlconf param to HttpRequest #2239

Open bigfootjon opened 2 weeks ago

bigfootjon commented 2 weeks ago

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

ngnpope commented 2 weeks ago

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 commented 2 weeks ago

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

adamchainz commented 2 weeks ago

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...