rcxwhiz / django-hierarchical-models

MIT License
1 stars 0 forks source link

Cycle detection on clean #16

Closed rcxwhiz closed 4 months ago

rcxwhiz commented 4 months ago

Because having cycles might really screw up a lot of stuff, it might be nice to include something where on clean() a HierarchicalModel will detect if it is a part of a cycle. I guess there might be some cases where this would be desired, but it would break some methods. For now I'll leave it, but it might be worth thinking about.

rcxwhiz commented 4 months ago

My thinking is that it should be optional if cycle detection is included in clean(), but I don't think clean() is normally supposed to take parameters so I might need to think about this one a little more. I could also just add a detect cycle method which the user can choose to include in their clean method. The detect cycle method could just return a boolean and then it would be on the user to throw an exception from that.