I am setting a cookie in django without response. when user logs in i trigger an api to authenticate its data and then i am trying to save its user_id in cookie in a class and then in another class am trying to delete the cookie means user is logged out.
class APIloginView(View):
def get(self):
r = requests.post(url,parameters)
if 'user_id' not in request.COOKIES:
request.COOKIES['user_id']='2133212332'
print(request.COOKIES.get('user_id'))
return HttpResponse(r)
but when i try to access in value in another class it is showing me none
class logout(View):
def get(self):
print(request.COOKIES.get('user_id'))
pass
Where am i doing wrong?and i know deleting a session like del request.session['user_id'],how to delete a particular cookie?