Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.views.generic.base import TemplateView
- from generic.mixins import CategoryListMixin
- class MainPageView(TemplateView, CategoryListMixin):
- template_name = 'mainpage.html'
- from django.views.generic.base import ContextMixin
- class CategoryListMixin(ContextMixin):
- def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
- context['current_url'] = self.request.path
- return context
- from django.shortcuts import render
- from django.views.generic.base import TemplateView
- from django.views.generic.base import ContextMixin
- class CategoryListMixin(ContextMixin):
- def get_context_data(self, **kwargs):
- context = super().get_context_data(**kwargs)
- context['current_url'] = self.request.path
- return context
- class MainPageView(TemplateView, CategoryListMixin):
- template_name = 'mainpage.html'
- from generic.mixins import CategoryListMixin
- from generic.mixins.CategoryListMixin import CategoryListMixin
Add Comment
Please, Sign In to add comment