Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango Tastypie: "error_message": "'bool' object has no attribute 'read'"
    text
    copied!<p>I am using <strong>Backbone.js + Tastypie + Django</strong> and am trying to save a model using patch = true to update the points on a model, like</p> <pre><code>this.save({ points: newPoints }, { patch: true }); </code></pre> <p>This issues a PUT request as it should with the request payload</p> <pre><code>points: 105 </code></pre> <p>However, I get a 500 error message</p> <pre><code>{"error_message": "'bool' object has no attribute 'read'", "traceback": "Traceback (most recent call last): File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/resources.py\", line 217, in wrapper response = callback(request, *args, **kwargs) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/resources.py\", line 468, in dispatch_detail return self.dispatch('detail', request, **kwargs) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/resources.py\", line 491, in dispatch response = method(request, **kwargs) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/resources.py\", line 1656, in patch_detail self.update_in_place(request, bundle, deserialized) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/resources.py\", line 1679, in update_in_place return self.obj_update(bundle=original_bundle, **kwargs) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/resources.py\", line 2209, in obj_update bundle = self.full_hydrate(bundle) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/resources.py\", line 909, in full_hydrate value = field_object.hydrate(bundle) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/tastypie/fields.py\", line 382, in hydrate value = make_aware(parse(value)) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/dateutil/parser.py\", line 720, in parse return DEFAULTPARSER.parse(timestr, **kwargs) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/dateutil/parser.py\", line 308, in parse res = self._parse(timestr, **kwargs) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/dateutil/parser.py\", line 356, in _parse l = _timelex.split(timestr) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/dateutil/parser.py\", line 150, in split return list(cls(s)) File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/dateutil/parser.py\", line 147, in next return self.__next__() # Python 2.x support File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/dateutil/parser.py\", line 141, in __next__ token = self.get_token() File \"/Users/me/.virtualenvs/project/lib/python2.7/site-packages/dateutil/parser.py\", line 72, in get_token nextchar = self.instream.read(1) AttributeError: 'bool' object has no attribute 'read' "} </code></pre> <p>Here is my model resource for UserProfile</p> <pre><code>class UserProfileResource(ModelResource): """A resource for the UserProfile model.""" class Meta: queryset = UserProfile.objects.all() resource_name = 'userprofile' authorization = Authorization() excludes = ['field_to_exclude'] always_return_data = True </code></pre> <p>Does anyone have tips on how to debug this error?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload