首页
发现了一个BUG

发现了一个BUG

05-23 11:17:49
144
2

发现了一个BUG,不确定是由什么引起的,目前我是用的版本是: simplepro 4.0.2

models代码:

from django.contrib.auth.models import User
from django.db import models
# Create your models here.
from simplepro.components import fields


class SupplierInfo(models.Model):
    name = fields.CharField(verbose_name='供应商名称', max_length=50, default='')
    add = fields.CharField(verbose_name='供应商地址', max_length=100, default='', null=True, blank=True)
    contact = fields.CharField(verbose_name='联系人', max_length=10, default='')
    phone = fields.CharField(verbose_name='联系人电话', max_length=20, default='', unique=True)
    compType = (
        (1, '对公账户'),
        (0, '非对公账户'),
    )
    isComp = fields.RadioField(verbose_name='属性', choices=compType, default=0)
    owner = models.ForeignKey(verbose_name='负责人', to=User, on_delete=models.SET_NULL, null=True,blank=True, editable=False)
    class Meta:
        verbose_name = '供应商管理'
        verbose_name_plural = verbose_name

admin的代码如下:

from django.contrib import admin
from simpleui.admin import AjaxAdmin

from .models import *
# Register your models here.

@admin.register(SupplierInfo)
class SupplierInfoAdmin(AjaxAdmin):
    list_display = ['name','add','contact','phone','isComp',]
    list_display_links = ['name','add','contact','phone','isComp',]
    list_filter = ['name','contact','phone','isComp',]
    list_per_page = 15

以上,在使用list_filter时会出现"local variable 'queryset' referenced before assignment" 提示,详见下图 WechatIMG21379.png

评论(2)