Added Django 1.5 compatibility - mode on file-like object is not set in django anymore