I'm starting to learn Django and I'm completely new to the MVC/MTV (whatever you want to call it) playground.
In Django templates can perform logical conditions and filters. I want to know from a performance standpoint, is it better to do the conditions in the view or on the template itself.
I actually find my self more comfortable with doing everything behind t开发者_StackOverflowhe scenes and if there is no difference in terms of performance, then I'd rather do it from the view.
I suggest separating your logic in the following way:
- Implement the logic belonging to what your application is doing under the hood in your Django handlers. It usually covers most of your logic. 
- Implement only the logic belonging to the actual presentation in your HTML templates. For example you can put you logic selecting different styles for various rows of a table based on a complex condition (not just odd/even) or so. 
It worked pretty well for me.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论