Is there a way of figuring out inside a Django model field validator function if it used for update or insert?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, there isn’t. A validator is simply a callable that takes a value and checks it. It has no access to the field or instance being validated, so it is impossible to tell whether it is a new or existing instance.