[Django]-__init__() got an unexpected keyword argument 'mimetype'

26👍

I think you are not using the latest version of django-ajax-selects package.

There was a related fix made in July 2014:

According to a changeset, mimetype was replaced by content_type.


Either run pip with an upgrade flag:

pip install --upgrade django-ajax-selects

or, install it directly from github:

git clone https://github.com/crucialfelix/django-ajax-selects.git
cd django-ajax-selects
python setup.py install
👤alecxe

15👍

In Django 1.6, the HttpResponse is like

if mimetype:
    warnings.warn("Using mimetype keyword argument is deprecated, use"
         " content_type instead",
          DeprecationWarning, stacklevel=2)
    content_type = mimetype

We are just warning and assigning the mimetype to the content_type.

In Django 1.8, we are not using mimetype. Instead of this directly we are assigning the value like “image/png”, etc.., to the content_type. Just a DRY concept.

For Example

my_file = open('newimage.jpg','rb').read()
return HttpResponse(my_file, content_type = "image/png")

Leave a comment