pathagar
pathagar copied to clipboard
rework validate_unique() and how it is used
Following #90, valide_unique() needs rewrite:
-
super()is not called ! - A proper ValidationError is called with NON_FIELD_ERRORS (https://docs.djangoproject.com/en/1.11/ref/exceptions/#non-field-errors) but this key is not reused by management command: it led to inconsistent reporting errors:
-
addbooksuse ValidationError to report duplicated ebook: it should show real message from exception -
addepubsuse IntegratyError (and dirty message check) to report duplicated ebook but it cannot detect anymore as #90 force use ofvalidate_unique()
-
-
validate_unique()does not detect fact that user edit book (#83)
Note:
validate_unique() method seems to be called by Forms (to be checked on Django 1.8 and later) and it's why method is called inside management command.