Skip to content

Instantly share code, notes, and snippets.

@cypreess
Created May 4, 2013 19:45
Show Gist options
  • Save cypreess/5518514 to your computer and use it in GitHub Desktop.
Save cypreess/5518514 to your computer and use it in GitHub Desktop.
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"
@MichalKorzycki
Copy link

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()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment