开发者

Will this make changes to "request", in Django?

开发者 https://www.devze.com 2023-02-01 04:56 出处:网络
# in views.py def start(request): initial_dictionary = {\"abc\":\"abc\"} request.session[\'123\'] = \"xyz\"
# in views.py

def start(request):
    initial_dictionary = {"abc":"abc"}
    request.session['123'] = "xyz"
    return initial_dictionary


def post开发者_C百科(request):
    dictionary = start(request)
    return render_to_response("blah")

This is OOP. Will this make changes to "request", and will the session be set? (request is passed as a pointer)


The session object comes from the HttpRequest, so if that's what gets passed into the function as request then what you have should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消