401 HttpResponse

1
2
3
4
5
6
    class HttpResponseNotAuthorized(HttpResponse):
        status_code = 401

        def __init__(self, redirect_to):
            HttpResponse.__init__(self)
            self['WWW-Authenticate'] = 'Basic realm="%s"' % Site.objects.get_current().name

More like this

  1. HTTP headers view decorator by dottedmag 6 years, 10 months ago
  2. Validate request params without custom form by xiaoym 1 year ago
  3. another render_to_response wrapper by ro60 6 years, 3 months ago
  4. JsonResponse by zakj 7 years ago
  5. IP Authorization Decorator with IP list by jansta 3 years, 2 months ago

Comments

jerry2801 (on October 19, 2009):

how can i use above code?

#

(Forgotten your password?)