def logout(request):
    url = request.META.get('HTTP_REFERER', '/Buyer/index/')
    response = HttpResponseRedirect(url)
    cookies = request.COOKIES.keys()
    for cookie in cookies:
        response.delete_cookie(cookie)
    if request.session.get('user'):
        del request.session['user']
    return response
def logout(request):
    url = request.META.get('HTTP_REFERER', '/Buyer/index/')
    response = HttpResponseRedirect(url)
    cookies = request.COOKIES.keys()
    for cookie in cookies:
        response.delete_cookie(cookie)
    if request.session.get('user'):
        del request.session['user']
    return response