Global-signbank
Global-signbank copied to clipboard
Code hygiene: make a Django model about the database again
I think the Django philosophy (and the 'model view template' philosohpy in general) is that:
- Templates are for the appearance of the web application
- Models are for describing the database structure
- Views are for the 'calculations' and logic in between
While it is totally okay to have a few lines of code inside a model, for example to construct some more information about that 1 object on the fly, I notice that we are often doing lots of logic inside model itself, in particular for the Gloss model. I think that this should be considered 'dirty' and that we should refactor for this to be in a view or helper function.
A pattern I feel should be avoided in particular is logic where inside a model (like a gloss) something is done or comparisons are made to other objects (other glosses).