adamspd / django-appointment

A Django app for managing appointment scheduling with ease and flexibility.
Apache License 2.0
89 stars 30 forks source link

model.Service: move validation logic in validators #161

Closed deronnax closed 3 months ago

deronnax commented 3 months ago

Same logic than #158: in Django, validation doesn't belong to Model.save(). It also results in less code, more is delegated to django itself. Less code on our side is less bugs and less maintenance.

Also, in case of bulk update, the custom save method is not called.

For real model-level validity guarantee, we should use database constraints (but they come with their caveats: it more robust than django validation but it's also significantly more constraints once they are in place).