Could not google. How can the validator on the model check whether a record is added or edited? Validation is used in the model description:

filename = models.FileField(upload_to='files', validators=[validateDublicateFile]) 

    2 answers 2

    If the id is already there, it is edited.

    • one
      Thanks - kirsrus

    In the field validator - in any way, the field does not know in which model it is used (or generally separate from the model).