Skip to content

Instantly share code, notes, and snippets.

@munisisazade
Created April 21, 2020 20:09
Show Gist options
  • Select an option

  • Save munisisazade/20e3bcf6641c632b9d5223a91e6c29a3 to your computer and use it in GitHub Desktop.

Select an option

Save munisisazade/20e3bcf6641c632b9d5223a91e6c29a3 to your computer and use it in GitHub Desktop.
Context data sharing between generic class django
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