在我的 models.py 中,这是我的类结构:
class Department_master(ModelWithoutAppName):
rec_id = models.AutoField(primary_key=True)
department_code = models.CharField(max_length=50)
department_name = models.CharField(max_length=50)
FALSE = '0'
TRUE = '1'
Status_choices = (
(TRUE, 'True'),
(FALSE, 'False'),
)
status=models.CharField(max_length=2,
choices=Status_choices,
default=TRUE)
def __unicode__(self):
return self.department_name
现在我已经通过以下方式在 Admin(admin.py) 中注册了这个模型:
admin.site.register(Department_master)
现在,当我要管理员查看详细信息时,首先它显示:
Department_masters (the model class name)
当我点击 Department_masters 时:
Department_master (the model class name)
Testing (added department_name in the table department_master as my __unicode__ returns self.department_name)
现在我想更改我目前在管理部分查看的模型类名称
Department_master to Department Master.
而且还想展示的不仅仅是
department_name under Department_master
还
department_code by modifying __unicode__ return
可能吗?