I have a problem with django's MVC. I understand that this is not the traditional MVC, but the documentation emphasizes throughout that it indeed separates presentation from business logic. However, the tutorial comes to a piece of code like this:
def vote(request, poll_id):
p = get_object_or_404(Poll, id=poll_id)
try:
selected_choice = p.choice_set.get(id=request.POST['choice'])
except (KeyError, Choice.DoesNotExist):
return render_to_response('polls/detail.html',
{ 'poll': p, 'error_message': 'You didn''t select a choice.' } )
else:
selected_choice.votes += 1
selected_choice.save()
return HttpResponseRedirect(reverse('mysite.polls.views.results', args=(p.id,)))
return render_to_response('polls/vote.html', {'poll': p})
(this is maybe not exactly the same as in the tutorial, as it is my implementation, but the concept is the same)
At this part, it handles the request, and (possibly) inserts a record into the database.
Isn't this wrong? Shouldn't it be somewhere in the model? What happens in more complex scenarios? Won't the views get cluttered with lots of db-intensive code, and minimal presentation? Do larger applications have much longer (as in LOC) views?