断言失败:没有找到'0'Django REST和Ember适配器的模型 [英] Assertion failed: No model was found for '0' Django REST and Ember Adapter

查看:161
本文介绍了断言失败:没有找到'0'Django REST和Ember适配器的模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下代码收到错误:

I'm getting the error with the following code:

App.SearchRoute = Ember.Route.extend({
    model: function(){
        return this.store.find('cabinets')
    }
});
App.SearchAdapter = DS.DjangoRESTAdapter.extend({
   namespace: 'rest_framework'
});

我创建了模型,但不能正确格式化JSON,我不知道我在做什么

I created the model but its not formatting the JSON correctly and I'm not sure what I am doing wrong.

此外,如果我用这个代码代替:

Also if I pump in this code instead:

App.Store = DS.DjangoRESTStore.extend({
 adapter: DS.DjangoRESTAdapter.create({
    namespace: "rest_framework"
 }),
 revision: 12
 });

我在扩展方法中收到错误....

I get an error on the extend method....

这是我从测试的JSON返回。

Here is my JSON return from a test.

0: {id:1, cabinet_name:HR Department, cabinet_security:1, status:1}


推荐答案

什么铬显示我

DEBUG: ------------------------------- ember.js:3231
DEBUG: Ember      : 1.3.0-beta.1+canary.628071a4 ember.js:3231
DEBUG: Ember Data : 1.0.0-beta.4+canary.e7996c4d ember.js:3231
DEBUG: Handlebars : 1.0.0 ember.js:3231
DEBUG: jQuery     : 1.10.2 ember.js:3231
DEBUG: ------------------------------- 

哦,有没有引用我没有注意到那些没有从调试器复制。

Oh yes there is quotes around I didnt notice that those didnt copy over from the debugger.

这里是我列出的,现在由于某些原因它的工作原理

Here is what I have listed and now for some reason it works

DS.DjangoRESTSerializer = DS.RESTSerializer.extend();
DS.DjangoRESTAdapter = DS.RESTAdapter.extend({
      defaultSerializer: "DS/djangoREST"
});

App.Store = DS.Store.extend({
        revision: 12,
        adapter: DS.DjangoRESTAdapter.create()
});
App.SearchAdapter = DS.DjangoRESTAdapter.extend({
    namespace: 'rest_framework'
});

这篇关于断言失败:没有找到'0'Django REST和Ember适配器的模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆