对于在Windows 10 64位机器上安装matplotlib得到错误显示
python setup.py egg_info" failed with error code 1 in C:\Users\Animus\AppData\Local\Temp\pip-build-urqbuxb_\unroll\
Run Code Online (Sandbox Code Playgroud)
请帮忙
如何使用tag在django 管理面板中进行搜索?
它将使用称为django-taggit包的标签进行搜索。
管理员.py
@staticmethod
def get_tags(obj):
tags = []
for tag in obj.tags.all():
tags.append(str(tag))
return ', '.join(tags)
list_display = (
'id'
'portions',
'get_tags',
'created'
)
search_fields = ('name', get_tags, 'created', 'id')`
Run Code Online (Sandbox Code Playgroud)
模型.py
from taggit.managers import TaggableManager
tags = TaggableManager(through=TaggedOffer, blank=True)
name = models.CharField(max_length=255)
price = models.DecimalField(
null=True,
max_digits=10,
decimal_places=2,
validators=[positive_decimal]
)
Run Code Online (Sandbox Code Playgroud)
错误
异常类型:FieldError 异常值:
无法将关键字“get_tags”解析为字段。