小编Asi*_*sif的帖子

EXCEPTION:状态响应:URL为0:angular2为null

当我尝试使用anguar2 http连接到远程API时,我遇到了异常.我的Web服务器也正在接收请求并正确响应.

我能够向本地服务器发出成功的curl请求.

EXCEPTION: Response with status: 0 for URL: null
Run Code Online (Sandbox Code Playgroud)

service.ts

getAllProducts(): Observable<string> {
      return this.http.get(this.productUrl)
      .map(this.extractData)
}

private extractData(res: Response) {
    let body = res.json();
    console.log(body)
    return body.data || { };
}
Run Code Online (Sandbox Code Playgroud)

flask flask-restful angular

11
推荐指数
1
解决办法
2万
查看次数

使用python 3.3在Django 1.9中导入WeakMethod错误

我正在使用django 1.9.1和python 3.3.在运行runserver时出现以下错误

File "/home/virtualenv/python3.3.5/lib/python3.3/site-packages/django/dispatch/__init__.py", line 9, in <module>
from django.dispatch.dispatcher import Signal, receiver # NOQA
File "/home/virtualenv/python3.3.5/lib/python3.3/site-packages/django/dispatch/dispatcher.py", line 14, in <module>
from weakref import WeakMethod
ImportError: cannot import name WeakMethod
Run Code Online (Sandbox Code Playgroud)

正如我在阅读python 3.4中引入的弱反射WeakMethod,并且它不存在于python 3.3的weakref中.

有关如何使用python 3.3修复相同错误的任何建议.

python django django-views python-3.x

3
推荐指数
1
解决办法
342
查看次数

Django查询多对多关系

我有以下两种模式

class Questionnaire(models.model)
     name = models.CharField(max_length=128, null=True, blank=True)
     type = models.CharField(max_length=128,choices=questionnaire_choices) 

class TestPopulation(models.Model)
      user = models.ForeignKey(User, blank=True, null=True)
      age = models.CharField(max_length=20, blank=True, null=True)
      education = models.CharField(max_length=50, blank=True, null=True, 
                                   choices=EDUCATION_CHOICES)
     questionnaire = models.ManyToManyField(Questionnaire, blank=True, null=True)
Run Code Online (Sandbox Code Playgroud)

现在如何获取特定用户(已登录用户)的问卷数量。?

python django django-models

0
推荐指数
1
解决办法
2814
查看次数