3 ms·
I don't know Django but doesn't model validation apply to the admin screens?
by petepete 3y ago
I don't know Django but doesn't model validation apply to the admin screens?
- loloquwowndueo 3y agoIt does but in general there’s less insistence (as compared to Rails, for example) to have “smart models, dumb controllers” - therefore in Django a lot of business logic can end up in the controller and thus doesn’t apply in the admin. This is a convention though - one could just as easily do it the other way and embed all the business rules in the models.
- withinboredom 3y agoIt used to not be IIRC. This was over a decade ago, so my information is likely outdated, but it might explain why other languages chose not to implement it. Further, a model may be valid, but make no sense to an application. For example, a car may have 6 wheels and still be a car ... but might be out-of-bounds for a simulation expecting 4 wheels.
- evantbyrne 3y agoMust have been well over a decade because Django models have had deep integration with the form validation API since I started my career.
- stuartjohnson12 3y agoI can confirm you can do this validation now, but it's not super-super easy.
- rburhum 3y agoyes it does if implemented correctly with that intention in mind