class Employee(models.Model):
employeeid=models.IntegerField(primary_key=True, editable=True)
fullname=models.CharField(max_length=500)
location=models.ForeignKey(Location, on_delete=models.CASCADE)
phone=models.IntegerField('phone number')
user = models.OneToOneField(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
)
def __unicode__(self):
return self.fullname
def __str__(self):
return self.fullname
class holidayAdmin(FilterUserAdmin):
form = select2_modelform(holiday,attrs={'width': '250px'})
fields= ('type','start_date','end_date','employees','image_ref','note',)
list_display = ('type','created_by','last_modified_by','start_date',
'end_date','note','employees')
错误 错误: :(admin.E109)'list_display [6]'的值不能是ManyToManyField。
答案 0 :(得分:1)
您无法在admin中的list_display中使用ManyToMany字段。
只需将list_display
更改为
list_display = ('type','created_by','last_modified_by','start_date',
'end_date','note')