Skip to content

Instantly share code, notes, and snippets.

@edgabaldi
Last active August 29, 2015 14:11
Show Gist options
  • Save edgabaldi/63614bc519a68f633282 to your computer and use it in GitHub Desktop.
Save edgabaldi/63614bc519a68f633282 to your computer and use it in GitHub Desktop.
overriding get_context_data in class based generic view
from django.views.generic import View
class MyView(View):
def get_modulos_permitidos(self):
"""
Escreva o queryset que retorna os módulos
permitidos aqui.
"""
return []
def get_context_data(self, **kwargs):
return super(MyView, self).get_context_data(
modulo_list = self.get_modulos_permitidos(),
**kwargs)
class ChildView(MyView):
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment