3 ms·
> But don't you think that listing table columns in Django model code is a violation of DRY (Don't Repeat Yourself)? Database already holds meta data. Repeating
by bad_user 17y ago
> But don't you think that listing table columns in Django model code is a violation of DRY (Don't Repeat Yourself)? Database already holds meta data. Repeating it in model code is unnecessary.
No, because the columns definitions in Django are complete. You specify their meaning, not their internal representation. And you can also add your own types easily.
In ActiveRecord you have to look at the DB schema for, well, the table definition, and you have to look again at the model's definition for validation rules or for relationship rules. It may be DRY, but it's not KISS.
And I never have to work with the database schema directly, like writing SQL for the schema definition (I only drop to the db's console for debugging purposes, nothing else). A migration utility like South can detect the code-changes I've made and write the migrations for me.