I have a pair of models which I want to reference one another, but not as a foreign key. Ideally, I want this reference just to be an attribute the model. But the problem is that the second model wont have been created for the first to reference.
Example:
class model1(models.Model):
...
relatedModel = model2
class model2(models.Model):
...
relatedModel = model1
A similar thing happens when a foreign key is created using double quotes such as
field = models.foreignKey('someModel')
But I dont want this relationship to be a foreignkey…
I hope this makes sense,
thanks
Class attributes don’t always need to be set when the class is defined, certainly not in this case: