Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

How do you rationalize including logic in the markup?


Presentation logic requires logic. If a designer decides to display a bunch of items as three columns rather than two columns, or to switch the display for a single item vs a number of different items, that's presentation logic. Ideally it should go in the template, if that's where you've chosen to keep it.

With Django, I often find myself writing view logic to support specific presentation tasks (regrouping items in a manner more complicated than Django's {% regroup %} template tag allows, for example). This used to bother me, but then I decided that pragmatism beats purity if you actually want to ship anything.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: