mixer
mixer copied to clipboard
Infinite loop if model includes more than one relations to self
backend: mixer.backend.django
I get an infinite loop then I try to create objects for model with two ForeignKey fields and relation to self.
For example:
command mixer.blend(SAPDepartment)
with the model:
class SAPDepartment(models.Model):
sap_name = models.CharField(max_length=150, null=False, blank=False)
sap_id = models.IntegerField()
upper_dep = models.ForeignKey('self', related_name='low_dep', on_delete=models.SET_NULL, null=True)
main_dep = models.ForeignKey('self', related_name='main_department', on_delete=models.SET_NULL, null=True)