Setting a limit to the creation of FlatMenu instances
heav1811 opened this issue · comments
Tiago commented
Hey,
hope you guys are doing fine, great project!
maybe its not the the right place but, since i can't find any information on docs, i'll just ask here.
I have an instance of flat menu:
class FlatMenuXPTO(AbstractFlatMenu):
"""The default model for 'flat menu' instances."""
pass
I wanted to limit the creation of the FlatMenu's instances, overriding some method. Can this be done? What is the "default" create/save?
Maybe its just Monday...
Thanks for your help
Tiago commented
It was indeed a Monday!
for anyone that finds this issue,
On the same method as above you can just do,
def clean(self):
if your_logic:
raise ValidationError('wwwww')
return MenuWithMenuItems.clean(self)