Hi! I would like to render views based on the user. I have some differents type of users on my app and I would like to create a class like this one for the view:
class MyView(MyCustomView) # MyCustomView subclass View
def __init__(self, *args, **kwargs):
# common code for all persons
def personA(self):
# code for personA
def personB(self):
# code for personA
# ....
def personN(self):
# code for personA
def anyPerson(self)
# For any user non listed above
Then if the MyView is run, the function based on the user is automatically fired.
My doubts (at the moment):
1) Do you think is the a good way to face the problem?
2) I have methods in the models to know what person is logged. How I can automatically load the right function in the class based on the user?
Thank you
--