Note that there are some explanatory texts on larger screens.

plurals
  1. PONo JSON object could be decoded with tastypie
    primarykey
    data
    text
    <p>I'm trying to test my API and I've never had this problem before. I'm getting the error: <code>No JSON object could be decoded</code>. I'm really stuck and would appreciate any help. I'm not even sure how to debug them.</p> <p>This only occurs on the "POST"</p> <p>Here's my API</p> <pre><code>from reflection.feedback.models import Feedback from django.contrib.auth.models import User from tastypie import fields from tastypie.api import Api from tastypie.authentication import Authentication from tastypie.authorization import Authorization from tastypie.exceptions import NotFound from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS class DjangoAuthentication(Authentication): """Authenticate based upon Django session""" def is_authenticated(self, request, **kwargs): return request.user.is_authenticated() class CommonMeta: authentication = DjangoAuthentication() authorization = Authorization() always_return_data = True class UserResource(ModelResource): class Meta(CommonMeta): queryset = User.objects.all() resource_name = 'user' excludes = ['email', 'password', 'is_active', 'is_staff', 'is_superuser'] filtering = { 'username': ALL, } class FeedbackResource(ModelResource): user = fields.ForeignKey(UserResource, 'user') class Meta(CommonMeta): queryset = Feedback.objects.all() resource_name = 'feedback' excludes = ['created',] allowable_methods = ['post',] filtering = { 'user': ALL_WITH_RELATIONS } def obj_create(self, bundle, request=None, **kwargs): return super(FeedbackResource, self).obj_create(bundle, request) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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