A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/HackSoftware/Django-Styleguide/issues/22 below:

Constraints instead of clean(), full_clean() · Issue #22 · HackSoftware/Django-Styleguide · GitHub

What do you think about moving all the logic from custom clean() methods on the model to the db constraints?
https://docs.djangoproject.com/en/2.2/ref/models/constraints/

Yes, some logic is not representable as a constraint, it could be an exception which could still reside inside the clean() method. But otherwise, constraints are always enforced, there's no need to remember to call full_clean() method. Also, there are usually faster than python validation.

pfcodes, Mohammed-abdelawal, MEhomer, KhaledHegazy222 and ajitzero


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4