I have a model in which there is an option to install if the item is active or not.
There is a limit on the number of elements that can have an โactiveโ property with a โtrueโ value.
I have an authentication code in AdminModel. So now, if when editing an element I mark it as โactiveโ and I have reached the limit of the โactvieโ elements, I am throwing an exception.
def clean_active(self): if self.cleaned_data["active"]:
In admin interface, I also have a list of objects. In this list I have been marked as an editable field "active", list_display = ('name', 'first_promotion', 'second_promotion', 'active') readonly_fields = ['name'] list_editable = ['active']
What I want is also the ability to do this check on the "list display" of the model. I cannot, where should I add a verification code to display a list.
Can someone show me how to do this? Thanks in advance.
source share