Django 限制字符串展示,超过30个展示...
def short_process_all(self):
if len(str(self.process_all)) > 30:
return '{}...'.format(str(self.process_all)[0:29])
else:
return str(self.process_all)
short_process_all.allow_tags = True
short_process_all.short_description = '问题描述'
short_process_all.admin_order_field = 'code'