def get_return_url(request):
    """
    for generic use; get "next" if available in GET, otherwise HTTP_REFERER
    """
    if 'next' in request.GET:
        return request.GET.get('next')
    return request.META.get('HTTP_REFERER')