Sharing view logic in Django

Posted by Jeremy B. on Stack Overflow See other posts from Stack Overflow or by Jeremy B.
Published on 2010-05-15T03:36:33Z Indexed on 2010/05/15 3:44 UTC
Read the original article Hit count: 336

Filed under:
|
|

I've begun diving into Django again and I'm having trouble finding the parallel to some common concepts from my life in C#. While using .NET MVC I very often find myself creating a base controller which will provide a base action implementation to take care of the type of stuff I want to do on every request, like retrieving user information, getting localization values.

Where I'm finding myself confused is how to do this in Django. I am getting more familiar with the MVT concept but I can't seem to find how to solve this scenario. I've looked at class based views and the generic views yet they didn't seem to work how I expected. What am I missing? How can i create default logic that each view will be instructed to run but not have to write it in each view method?

© Stack Overflow or respective owner

Related posts about django

Related posts about views