Reputation: 565
In my view.py;
def get_social_data(request):
author_name = request.GET.get('author')
// To do something
return HttpResponse(json.dumps(result), content_type='application/json')
In the same view.py but in different function, I need to use author_name. If I again write "author_name = request.GET.get('author')"
, it returns "NONE".
def profile_export(request, slug):
author_name = request.GET.get('author') // Now NONE.
Can you help me how to pass the value to profile_export() from get_social_data(). Or is there any other way to get author_name?
Thank you.
Upvotes: 0
Views: 70
Reputation: 9110
If is the same author
you can save it in a django session
in the first function and then use it from the session
in the second function.
def get_social_data(request):
author_name = request.GET.get('author')
session['author_name'] = author_name
.....
And in the second function;
def profile_export(request, slug):
author_name = session['author_name']
Upvotes: 1