Created
April 21, 2020 20:09
-
-
Save munisisazade/20e3bcf6641c632b9d5223a91e6c29a3 to your computer and use it in GitHub Desktop.
Context data sharing between generic class django
This file contains hidden or 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 import generic | |
| class CustomView(generic.View): | |
| def get_context_data(self, **kwargs): | |
| context = super(CustomView, self).get_context_data(**kwargs) | |
| context["menu"] = "menu" | |
| context["menu"] = "footer" | |
| return context | |
| class HomePage(generic.TemplateView, CustomView): | |
| def get_context_data(self, **kwargs): | |
| context = super(CustomView, self).get_context_data(**kwargs) | |
| context["data"] = "data" | |
| return context |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment