1

I want to display error message in case the instance I am creating is more than the maximum limit I have specified in a certain model. This is a inner condition.

I know that we can hide the + and override the has_add_permission method. This is used for user authentication in my application.

However, I wish to allow the instance to be created for a certain login who is a superuser based on the inner condition.

ValidationError gives me error u' max...' ValidationError at the url...

Can anyone guide?

1
  • Short answer: you can't. It's too late for validation from the save() method. Commented Feb 6, 2012 at 16:13

1 Answer 1

1

I don't know what an "inner condition" is.

However, you don't do this in the save method. You do it in a validator. For instance, you could define a clean method on your model to handle this, or use a custom form with the validation in.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.