提问者:小点点

Django管理中编辑时出现Django错误


当我试图在django管理员中更改我的一个模型时,我得到了以下错误。这是我的模型。

class Scan(models.Model):
    image = models.FileField(upload_to = 'images/', default = 'images/')
    R = models.IntegerField(255)
    G = models.IntegerField(255)
    B = models.IntegerField(255)
    description = models.CharField(max_length=100) 
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    project = models.ForeignKey(Project, 
    on_delete=models.CASCADE,null=True)
    clean = models.NullBooleanField(null=True, default= False)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/core/handlers/exception.py”,位于内部35。响应=获取响应(请求)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/core/handlers/base.py”,位于_get_response 128中。回应=自我。通过中间件处理异常(e,请求)

响应=wrapped_callback(请求,*callback_args,**callback_kwargs)_get_response中的文件/库/框架/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/core/handlers/base.py

包装器574中的文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/contrib/admin/options.py”。回归自我。管理站。管理员视图(视图)(*args,**kwargs)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/decorators.py”,位于_-wrapped_视图142中。响应=查看功能(请求,*args,**kwargs)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/views/decorators/cache.py”,位于函数44中。响应=查看功能(请求,*args,**kwargs)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/contrib/admin/sites.py”,位于内部223中。返回视图(请求、*args、**kwargs)

文件"/库/框架/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/admin/options.py"在add_view1553.返回self.changeform_view(请求,无,form_url,extra_context)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/utils/decorators.py”位于_包装62中。返回边界函数(*args,**kwargs)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/decorators.py”,位于_-wrapped_视图142中。响应=查看功能(请求,*args,**kwargs)

bound_func中的文件/库/框架/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/utils/decorators.py返回func.get(自我,类型(自我))(*args2,**kwargs2)

文件"/库/框架/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/contrib/admin/options.py"在changeform_view1450.返回自己。_changeform_view(请求,object_id,form_url,extra_context)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/contrib/admin/options.py”,位于“changeform”视图1482中。如果形式。_是否有效():

is_valid文件"/库/框架/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/forms/forms.py"返回self.is_bound而不是self.errors

错误174中的文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/forms/forms.py”。自己完全清洁

文件"/库/框架/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/forms/forms.py"在full_clean378。自我。_post_clean()

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/django/forms/models.py”位于\u post\u clean 401中。自己例子完全清除(排除=排除,验证唯一=假)

文件“/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site packages/django/db/models/base.py”,全文1151页。自己干净的

异常类型:TypeError at /admin/api/scan/add/异常值:bool对象不可调用


共1个答案

匿名用户

你凌驾于清洁之上,这是模型中的一个功能。重命名该变量。