我正在设计一个学生数据库,我收到了这个错误:'str‘对象不可调用。我找不到错误的位置,所以我会粘贴我的小app.Thank你。
TypeError at /school/
'str' object is not callableRequest Method: GET
Request URL: http://tafe.pythonanywhere.com/school/
Django Version: 1.3.5
Exception Type: TypeError
Exception Value: 'str' object is no
我的api使用rest框架的令牌身份验证。最近我发现了一个问题,如果请求中提供的令牌无效,django会抛出TypeError at /api/users/: 'exceptions.KeyError' object is not callable,而不是返回Invalid Token响应。
我检查了一下跟踪,发现了这个:在django/db/models/query.py(Django version=1.7)文件的第357行,在raise DoesNotExists exception call中,是由self.model._meta.object_name引发的实际异常T
我正在使用django开发Rest。我有这样的模型:
from django.db import models
from devices.models import Device
class Command(models.Model):
id = models.AutoField(primary_key=True, blank=True)
command_name = models.CharField(max_length=70, blank=False, default='')
time = models.DateTimeField(auto_now
更新2,13日1月13日:在进行了一些错误搜索并试图使用json将对象直接发布到根API中之后,我开始意识到图像是给我发贴错误的原因。
我使用HTML表单发布一个对象,它给了我这个错误:
TypeError at /rats/
'Image' object is not callable
关于上下文,我上传了一张图片。下面是用于创建对象(rat)和图像的序列化程序:
class ImageSerializer(FlexFieldsModelSerializer):
image = VersatileImageFieldSerializer(
sizes
我正在学习如何在的帮助下使用Django运行本地主机。我目前正在尝试使用以下方法运行本地服务器:
python manage.py runserver
当我运行它时,终端中给出的输出如下:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
February 26, 2022 - 15:21:09
Django version 3.2.5, using settings 'mysite.settin
我有一段抛出错误的代码:TypeError: 'ModelSignal' object is not callable。 当我要在我的项目中添加信号时,出现了这个错误。为什么会发生这种类型的错误?你需要知道什么才能给我答案? 请帮帮我。我是姜戈的新手。提前谢谢。 这是我的views.py文件: def registerPage(request):
form = CreateUserForm()
if request.method == "POST":
form = CreateUserForm(request.POST)
我刚开始使用.loc,但每次我尝试使用它时,它都会返回'TypeError:'DataFrame‘object is not callable’。
例如,我不能让这个简单的代码(在pokemon API上使用)工作:
print(df.loc(df('Attack') > 175))
TypeError: 'DataFrame' object is not callable
有没有人能帮帮我,为什么它不能工作,真的很困扰我?
当我试图在Django中这样做时:
organisms = Organism.objects.filter(code=c)
fields = ['name', 'linnean_type', 'age'] # in reality there are more
for o in organisms:
for f in fields:
print o[f]
我知道这个错误:
TypeError 'Organism' object has no attribute '__getitem__'
有
我正在尝试使用Django Admin删除一个用户,但是我得到了这个错误:
TypeError: coercing to Unicode: need string or buffer, User found
导致此错误的原因是什么?
完全错误:
TypeError at /admin/auth/user/
coercing to Unicode: need string or buffer, User found
Request Method: POST
Request URL: http://www.domain.com/admin/auth/user/
Exception Type:
当我试图加载我的类别时,我得到了下面的错误。发布的值是“1”,并且存在于DB中,
TypeError at /events/add/
int() argument must be a string or a number, not 'Category'
Request Method: POST
Request URL: http://127.0.0.1:8000/events/new/
Django Version: 1.4
Exception Type: TypeError
Exception Value:
int() argume
我正在使用django-nonrel和django-mongodb-engine
我在PostgreSQL上存储了一个Django模型
class Author(models.Model):
name = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True)
我有一个MongoDB存储模型:
class Post(models.Model):
title = models.CharField(max_length=100)
body = models.
这就是我的代码:我已经用Python3.8、3.7.6尝试过了。它打开窗户并立即关闭它。此外,它还显示了一个错误:
如果event.type == pygame.QUIT():TypeError:'int‘对象不可调用
import pygame
#initialize the pygame
pygame.init()
#create the screen
screen = pygame.display.set_mode((800,600))
running = True
while running:
for event in pygame.event.get(
我正在尝试修改一个元组中的列表,append方法可以工作,而+=操作符还可以工作,但有一个例外情况,即不能修改tuple。我知道元组是不可变的,但我不想让它变异。为什么会发生这种事?
In [36]: t=([1,2],)
In [37]: t[0].append(123)
In [38]: t
Out[38]: ([1, 2, 123],)
In [39]: t[0]+=[4,5,]
---------------------------------------------------------------------------
TypeError
我正在将我的项目从Django 1.8.2升级到1.9.7,并收到以下警告:
WARNINGS:
my_app.my_model.date_available: (fields.W161) Fixed default value provided.
HINT: It seems you set a fixed date / time / datetime value as default for this field. This may not be what you want.
If you want to have the current date as default, use `dj
日安!
我根据官方文档中的教程在django上创建了一个应用程序,但是我得到了以下错误:
Traceback (most recent call last):
File "c:\python372\Lib\threading.py", line 926, in _bootstrap_inner
self.run()
File "c:\python372\Lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\v
我突然发现代码中出现了一个奇怪的错误,这个错误以前是有效的。我最近将Django从1.9.4升级到1.9.6。
我的一种看法是:
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
messages.success(request, str( _('A string with a ') +
'<a target="_blank" href="/preview/' + mymodel.hash
以下是django中的错误:
File "C:\Users\USER\Desktop\Python\CarRentalSystem\system\urls.py", line 6, in <module>
url(r'^$', 'system.views.home', name = "home"),
File "C:\Users\USER\Desktop\Python\lib\site-packages\django\conf\urls\__init__.py", line 13, in u
我对Django和JS有一个基本的了解,最近我开始学习Angular.js。我编写了使用Angular显示硬编码json的代码,但失败了。我得到了以下错误:
Uncaught TypeError: Cannot read property 'module' of undefined at line 10 of django-angular.js
我看了一遍文件,看到了这一行:
var djng_forms_module = angular.module('ng.django.forms', []);
我不知道未定义的错误是什么意思。我浏览了一些有类似问题的链接,