Last active
August 29, 2015 14:11
-
-
Save edgabaldi/63614bc519a68f633282 to your computer and use it in GitHub Desktop.
overriding get_context_data in class based generic view
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
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