想請益一下
目前我的Django 版本為3.2.6
我在model裡面建立了兩個資料表
class Theme(models.Model):
id = models.AutoField(primary_key=True, verbose_name='序號')
title = models.CharField(max_length=1024,null=True,unique= True,verbose_name='標題')
date = models.CharField(max_length=1024,null=True,verbose_name='時間')
class Themelist(models.Model):
id = models.AutoField(primary_key=True, verbose_name='序號')
cat_id = models.ForeignKey(Theme, blank=True, on_delete=models.CASCADE, null=True, verbose_name='上層')
title = models.CharField(max_length=1024,null=True,verbose_name='標題')
floor = models.CharField(max_length=1024,null=True,verbose_name='樓層')
在admin裡面為下
@admin.register(Theme)
class ThemeAdmin(ImportExportActionModelAdmin):
list_display = ('id','title','date')
@admin.register(Themelist)
class ThemelistAdmin(ImportExportActionModelAdmin):
list_display = ('id','cat_id','title','floor')
ForeignKey的上層有出現下拉選單,但希望是能帶入資料表Theme欄位title的中文字
不知道應該如何修改呢?