<p>I am just starting to play with Django/Python and am trying to shift into the MTV mode of programming that Django asks for (insists on).  Deciding on what functions should be methods of a model vs simple being a function in a view has so far been confusing.  Does anyone know of a book, website, blog, slideshow, whatever that discusses Web Framework programming in more general, abstract terms?  I imagine just a book on object oriented programming would do it, but I feel like that would be overkill - I was looking for something web framework specific.</p>

[{'answer_id': 22233, 'author': 'tslocum', 'author_id': 1662, 'author_profile': 'https://Stackoverflow.com/users/1662', 'pm_score': 0, 'selected': False, 'text': '<p>If you aren\'t absolutely set on diving into Django and don\'t mind trying something else as a start, you might want to give <a href="http://www.python.org/dev/peps/pep-0333/" rel="nofollow noreferrer">WSGI</a> a shot, which allows you to template your application your own way using a <a href="http://pypi.python.org/pypi/Tenjin/0.6.2" rel="nofollow noreferrer">third party engine</a>, rather than having to go exactly by Django\'s rules.  This also allows you to peek at a lower level of handling requests, so you get a bit better understanding of what Django is doing under the hood.</p>\n'}, {'answer_id': 22280, 'author': 'Austin Moody', 'author_id': 1754676, 'author_profile': 'https://Stackoverflow.com/users/1754676', 'pm_score': 0, 'selected': False, 'text': '<p>Here are a few links that might be helpful as an overview.</p>\n\n<p>From my own experience, when I first started using MVC based web-frameworks the biggest issue I had was with the Models.  Prying SQL out of my fingers and making me use Objects just felt strange.  Once I started thinking of my data as Objects instead of SELECT statements it started getting easier.</p>\n\n<ul>\n<li><a href="http://www.loudthinking.com/arc/000201.html" rel="nofollow noreferrer" title="MVC: In laymen&#39;s terms">MVC In laymen\'s terms</a></li>\n<li><a href="http://www.slash7.com/articles/2005/02/22/mvc-the-most-vexing-conundrum" rel="nofollow noreferrer">MVC: The Most Vexing Conundrum</a></li>\n<li><a href="http://st-www.cs.uiuc.edu/users/smarch/st-docs/mvc.html" rel="nofollow noreferrer">How to use Model-View-Controller</a></li>\n</ul>\n'}, {'answer_id': 22325, 'author': 'Matthew Christensen', 'author_id': 2123, 'author_profile': 'https://Stackoverflow.com/users/2123', 'pm_score': 1, 'selected': False, 'text': '<p>My basic rule in Django is: if you could conceivably need the functionality from somewhere other than the view itself, it doesn\'t belong in the view function. </p>\n\n<p>I\'d also recommend downloading some of the plethora of apps on <a href="http://djangoplugables.com/" rel="nofollow noreferrer">Django Pluggables</a> and seeing how they do it.</p>\n'}, {'answer_id': 22351, 'author': 'Acuminate', 'author_id': 2482, 'author_profile': 'https://Stackoverflow.com/users/2482', 'pm_score': 0, 'selected': False, 'text': '<p>View function should only contain display helpers or display logic. View functions should never access the model itself, but should take parameters of model data. It is important to separate the model from the view. So if the function handles accessing the database or database objects, it belongs in the model. If the function handles formatting display, it belongs in the view.</p>\n'}, {'answer_id': 23143, 'author': 'Henrik Paul', 'author_id': 2238, 'author_profile': 'https://Stackoverflow.com/users/2238', 'pm_score': 1, 'selected': False, 'text': '<p>Once you <em>do</em> find some good guide, here\'s something to remember: Django is a bit special with its terminology. It uses "MTV" for Model, Template and View (and can mention also a URL Dispatcher somewhere along the way), whereas a more standard set of terms is "MVC" for Model, View and Controller.</p>\n\n<p>Model is the same in both meanings - a model of a data entity, often linked to a database table, if the framework implements Object/Relational Mapping (which Django does).</p>\n\n<p>But the two remaining terms might be confusing; where Django talks about Views, the \'rest of the world\' talks about Controllers. The basic idea is that this is where the presentation logic is done. Calculations are calculated, arrays are sorted, data is retrieved, etc. I\'d say that Django\'s URL dispatcher is also a part of the conventional Controller concept.</p>\n\n<p>Django\'s Templates are comparable to Views elsewhere - here you have your presentation, nothing else. Where Django forces you to a very small set of logical commands, other frameworks often just recommend you not to do anything than present HTML, with some presentation logical elements (like loops, branches, etc), but don\'t stop you from doing other stuff.</p>\n\n<p>So, to recap:</p>\n\n<ul>\n<li><strong>Model:</strong> Data objects</li>\n<li><strong>Controller (View in Django):</strong> Data process</li>\n<li><strong>View (Template in Django):</strong> Presentation</li>\n</ul>\n\n<p>Oh, btw: For a Django-specific guide, consider reading <a href="http://djangobook.com/" rel="nofollow noreferrer">The Django Book</a></p>\n'}, {'answer_id': 210195, 'author': 'David Heggie', 'author_id': 4309, 'author_profile': 'https://Stackoverflow.com/users/4309', 'pm_score': 1, 'selected': False, 'text': '<p>I\'ve not really used Django in anger before, but in Rails and CakePHP (and by extension, any MVC web-framework) the <a href="http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model" rel="nofollow noreferrer">Fat Model, Skinny Controller</a> approach to organising your methods has been a real eye-opener for me.</p>\n'}]
['https://Stackoverflow.com/questions/22211', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2468/']