django forms from two tables referencial integrity
- by dana
i have a class named cv,and a class named university, and each user that completes his cv, should choose a University he studyes at.
My problem is: one student can study at one or 2 or three universities, or may be a user that is not student.
I need to take this data into a form, and i use ModelForm. The data from the Cv class, and from the University class in the same form, and the user can add one or more universities, or no university. (in the same form)
How should i do it? Should i use ModelForm? if i have a foreign key in the CV class, and the user is not a student (so he is at zero universities), i may get an referencial integrity error.
thanks a lot