Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#20570 closed Cleanup/optimization (invalid)

HttpRequest.REQUEST is still mentioned in the documentation

Reported by: jeff.revesz@… Owned by: nobody
Component: Documentation Version: 1.5
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


The documentation page still mentions HttpRequest.REQUEST as an alternative to HttpRequest.GET and HttpRequest.POST

However I get an error when I try to access this attribute, and in addition it does not appear in the class documentation at which leads me to believe that this attribute no longer exists. It should be removed from the the request-response documentation page.

Change History (4)

comment:1 Changed 2 years ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

It does still exist. Your link is to the wiki, not the official documentation:

That being said, there is a ticket to deprecate it, #18659.

comment:2 Changed 2 years ago by anonymous

Ah, sorry! I think my problem was that I was using RequestFactory to generate the request. My best guess is that the RequestFactory class does not produce an HttpRequest with a REQUEST attribute.

comment:3 Changed 2 years ago by bmispelon


It seems to be working fine for me:

>>> from django.test.client import RequestFactory
>>> request = RequestFactory().get('/foo/?bar=baz')
>>> request.GET
<QueryDict: {'bar': ['baz']}>
>>> request.REQUEST
MergeDict(<QueryDict: {}>, <QueryDict: {'bar': ['baz']}>)

Can you provide some steps to reproduce your issue?


comment:4 Changed 2 years ago by anonymous

Sorry, turns out was not RequestFactory either. I was hand-generating a request like this:

r = HttpRequest()
r.method = 'GET'
r.GET = QueryDict('foo')

RequestFactory( ) still works fine, this was just an oversight on my part. Sorry to waste everyone's time!

Note: See TracTickets for help on using tickets.
Back to Top