[Answer]-Setting POST or GET request data to a QueryDict in the manage.py shell

1πŸ‘

βœ…

Can you paste what you are typing? I’m able to add data to the GET dictionary.

(stackoverflow)➜  my_project  python ./manage.py shell
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.http import HttpRequest
>>> req = HttpRequest()
>>> print req
<HttpRequest
path:,
GET:{},
POST:{},
COOKIES:{},
META:{}>
>>> req.GET['test'] = 'hello world'
>>> print req
<HttpRequest
path:,
GET:{'test': 'hello world'},
POST:{},
COOKIES:{},
META:{}>
>>>
πŸ‘€Scott Woodall

Leave a comment