mixer icon indicating copy to clipboard operation
mixer copied to clipboard

Infinite loop if model includes more than one relations to self

Open kosdmit opened this issue 7 months ago • 0 comments

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)

kosdmit avatar Jul 23 '24 13:07 kosdmit