twoscoops / two-scoops-of-django-1.6

Tracking thoughts and feature requests for Two Scoops of Django 1.6
51 stars 7 forks source link

Chapter 9. Page 117. Section 9.6. Example 9.14. Replace 'mimetype' by 'content_type' for HttpResponse #86

Closed ssebastianj closed 9 years ago

ssebastianj commented 10 years ago

According to Django 1.6 documentation for HttpResponse and Outputting PDF example the parameter mimetype was deprecated and now it's recommended to use content_type instead.

Current example:

class PDFFlavorView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
    ...
    # create the response
    response = HttpResponse(mimetype='application/pdf')
    ...

Recommended:

class PDFFlavorView(LoginRequiredMixin, View):
    def get(self, request, *args, **kwargs):
    ...
    # create the response
    response = HttpResponse(content_type='application/pdf')
    ...

Nice book, BTW!! :smile:

pydanny commented 9 years ago

Nice catch! :ship: