나는 직원의 완전한 정보를 저장하는 응용 프로그램을 만들고 있는데, 이제는 내 개발의 문제는 종속물로 추가하는 사람이 Person 모델에 항목을 가져 오는 방식으로 직원의 피부양을 입력한다는 것입니다 .Foreignkey가 포함 된 모델에서 편집 양식을 만드시겠습니까?
의존하고 DependentRelationship 모델 봐처럼 :
class DependentForm(forms.ModelForm):
relationship = forms.CharField(_('relationship')) # TODO: max_length??
class Meta:
model = Dependent
나는 모든 보여주고 싶었 :
class Dependent(Person):
"""Dependent models: dependents of employee"""
occupation = models.CharField(_('occupation'), max_length=50, null=True,
blank=True)
self_dependent = models.BooleanField(_('self dependent'))
class DependentRelation(models.Model):
"""Dependent Relation Model for Employee"""
employee = models.ForeignKey(Employee, verbose_name=_('employee'))
dependent = models.ForeignKey(Dependent, verbose_name=_('dependent'))
relationship = models.CharField(_('relationship with employee'),
max_length=50)
class Meta:
ordering = ('employee', 'dependent',)
unique_together = ('employee', 'dependent')
내가이 종속에 대한 데이터를 입력 할 수 ModelForm를 사용하고 종속 추가하는 형태이다 직원의 정보뿐만 아니라 직원과의 관계를 편집 양식으로 표시합니다. 가능한 전망이 있습니다.
어떤 제안이나 나에게 많은 도움이 될 수있는 링크 ....... 미리
감사 .....................
내 질문에 내 모델 양식을 정의함에 따라