Infinite loop if model includes more than one relations to self
- Dominant language
- Python
- Stars
- 953
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
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:
```python
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)
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the Django backend path exercised by mixer.blend(SAPDepartment), using the reported SAPDepartment model with its two self-referential ForeignKey fields. Reproduce the hang and trace the object-generation flow until the repeated self-relations are identified. Done means creating SAPDepartment objects with both relations no longer loops indefinitely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- django, python
- Domain
- backend, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100