On Fri, Apr 7, 2017 at 9:54 AM, Adam Johnson <m...@adamj.eu> wrote:
> Personally I'd be in favour of adding such classes. It seems against the
> batteries-included philosophy that Django does not provide all of the
> standard codes as classes. I can never remember which codes correspond to
> which response types, if I saw status=204 in code it would be a 'magic
> number' for me and I'd have to look it up. HttpResponseRedirect and
> HttpResponsePermanentRedirect have been my friends in the past, I can
> imagine the same for HttpResponseNoContent.

Alternatively, they can use the HTTPStatus enum from the stdlib if
they are on Python 3.5+:

    from http import HTTPStatus

    HttpResponse(status=HTTPStatus.NO_CONTENT)

--Berker

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAF4280K-fT8bRnc6fvpZj0RjuhK8b2-eSozMKEJMsPT0EinevQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to