pathagar icon indicating copy to clipboard operation
pathagar copied to clipboard

rework validate_unique() and how it is used

Open murlock opened this issue 8 years ago • 0 comments

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:
    • addbooks use ValidationError to report duplicated ebook: it should show real message from exception
    • addepubs use IntegratyError (and dirty message check) to report duplicated ebook but it cannot detect anymore as #90 force use of validate_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.

murlock avatar May 21 '17 16:05 murlock