我有一个关于一个人的以下模型,我已经在管理界面-in Person-中创建了一个按钮,去了一个类合同,我向相关人员添加了一个合同:
class Person(models.Model):
name = models.CharField(max_length=32, verbose_name=_(u"Name"))
surname = models.CharField(max_length=32, verbose_name=_(u"Surname"))
address = models.CharField(max_length=32, verbose_name=_(u"Address"))
class Contract(models.Model):
person = models.ForeignKey(Person) #person hired
project = models.ForeignKey(Project, blank = True, null = True) #related project
starting_date = models.DateField(blank = True, null = True)
ending_date = models.DateField(blank = True, null = True)
的myproject /模板/管理/ MyApp的/人/ change_form.html
{% block after_field_sets %}
<input type="button" value="New contract" onClick=" window.location.href='../../contract/add/' ">
{% endblock %}
有没有办法在班级合同中自动填充现场人员与其来自哪个人?
此外,如果我直接从管理面板转到合约应该具有默认行为(未填写)。