I have a model:
class MyModel(models.Model):
field_1 = models.ForeignKey(FirstModel)
field_2 = models.ForeignKey(SecondModel)
And I want to display a form which both fields but only one field at the same time can be set, otherwise validation return error.
How to do it (preferably in the model)?
1 Answer