On the website there is a block with the main news, which can be no more than 3. How to carry out such a test: use a validator:
def validate_count_main_posts(): if Post.objects.filter(main_posts=True) >=3: raise ValidationError('"main posts Too much!")
or to perform this check in the save method of a model?
PS: In django happen to have a built-in feature I'm not aware of for such a function? (After all, the task is quite frequent)
PSS: I Understand that this may be a matter of taste, but damn perfectionism wants to find out the best way))