Answer the question
In order to leave comments, you need to log in
What is the best way to limit the number of top stories?
The site has a block with the main news, which can be no more than 3. What is the best way to do this kind of validation: use a validator:
def validate_count_main_posts():
if Post.objects.filter(main_posts=True) >=3:
raise ValidationError('"Too much main posts!")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question