4 ms·
OUCH. Doesn't django let you check if models are valid without saving them? In rails I can do: Family.all.select {|f| !f.valid?}
by JonnieCache 15y ago
OUCH.
Doesn't django let you check if models are valid without saving them?
In rails I can do:
Family.all.select {|f| !f.valid?}
- kingkilr 15y agoDjango's ORM does (obj.full_clean()), but he's not using Django's ORM, he's using mongoengine, I have no idea if it does.
- sibsibsib 15y agomongoengine does do validation. It can be disabled on a per-model basis though.
- taylorfausak 15y agoDjango offers a validate function that does exactly that. Unfortunately, the email uniqueness constraint is handled in our save function, due to some backend complexity. So it wouldn't have helped here. Plus, it was a typo that caused the problem, not the function :)
- charliesome 15y agoI'm struggling to think of what kind of backend complexity would make it infeasible to check email uniqueness in validation. Care to elaborate?