I have a situation like below
class MyViewStorage(Object):
# methods
class MyView1(FormView):
# methods
class MyView2(FormView):
# methods
MyViewStorage
provides some methods to handle storage in MyView1
and MyView2
. These methods require instance attributes created in MyView1
and MyView2
.
There are two approaches I have now to use this class.
To inherit
MyViewStorage
in other two classes something asMyView1(FormView, MyViewStorage)
. Then process methods by simply using instance attributes created in other two classes.To create an instance of
MyViewStorage
by first creating initial instance arguments inMyView1
andMyView2
classes
as shown below
def __init__(self, obj, user, form):
self.obj = obj
self.user = user
self.form = form
Which one is preferred approach?