【发布时间】:2016-07-20 22:57:08
【问题描述】:
假设我有一个模型,其中有一个名为documentation 的类变量。我想访问给定模型更改表单模板中的documentation 类变量。我怎样才能做到这一点?保存实例后,我可以使用{{original.documentation}} 访问模板中的类变量。
示例模型
class Person(models.Model):
# How do I access this variable in my change form template
# before saving the new instace?
documentation = "The Person model will be used for all staff including researchers, professors, and authors."
first_name = models.CharField(max_length=255)
【问题讨论】:
标签: django django-admin