Created
May 4, 2013 19:45
-
-
Save cypreess/5518514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExtraValueMixin(object): | |
value = 1 | |
def get_value(self): | |
return self.value | |
def get_context_data(self, *args, **kwargs): | |
context = .... super ... get_context_data | |
context['extra_value'] = self.get_value() | |
return context | |
class MyCusotmView(ExtraValueMixin, DetailView): | |
model = MyModel | |
class MyOtherView(ExtraValueMixin, TemplateView): | |
template_name = "template.html" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
class A(object):
def f(self):
print "A"
class B(object):
def f(self):
print "B"
class AB(A,B):
pass
class BA(B,A):
pass
BA().f()
AB().f()