Django ModelForm: How to Add ForeignKey as Field in Form?
Django ModelForm: How to Add ForeignKey as Field in Form? I have Three Models StudentInfo , StdSubject , Marks class StdSubject(StdCommon): REGULAR='R' OPTIONAL='O' SUBJECT_TYPE_CHOICE=( (REGULAR, 'REGULAR'), (OPTIONAL, 'OPTIONAL') ) subject_name = models.CharField('Subject Name', max_length=100) subject_type = models.CharField( 'Subject Type', max_length=1, default=REGULAR, choices=SUBJECT_TYPE_CHOICE) subject_full_marks = models.DecimalField( 'Full Marks', max_digits=5, decimal_places=2, default=100) subject_pass_marks = models.DecimalField( 'Pass Marks', max_digits=5, decimal_places=2) def __str__(self): return self.subject_name class StudentInfo(StdCommon): STD_CLASS=( ('6','Six'), ('7','Seven'), ('8','Eight'), ('9','Nine'), (...