我想在這之前的帖子下面的回答: DateTimeField doesn't show in admin system管理面板,顯示date_created和date_updated?
但也許我只是太暗去了解它。
沒有顯示created_at的字段。任何人都可以將我指向正確的方向嗎?
模型
class holding_transaction(models.Model):
holdingname = models.ForeignKey(holding, on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
admin.py
class holding_transactionAdmin(admin.ModelAdmin):
readonly_fields = ('created_at',)
admin.site.register(holding_transaction, holding_transactionAdmin)
編輯:
您是否嘗試將其添加到'list_display' – jcfollower