Guest User

Untitled

a guest
Apr 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. from django.views.generic.base import TemplateView
  2. from generic.mixins import CategoryListMixin
  3.  
  4.  
  5. class MainPageView(TemplateView, CategoryListMixin):
  6. template_name = 'mainpage.html'
  7.  
  8. from django.views.generic.base import ContextMixin
  9.  
  10.  
  11. class CategoryListMixin(ContextMixin):
  12. def get_context_data(self, **kwargs):
  13. context = super().get_context_data(**kwargs)
  14. context['current_url'] = self.request.path
  15. return context
  16.  
  17. from django.shortcuts import render
  18. from django.views.generic.base import TemplateView
  19. from django.views.generic.base import ContextMixin
  20.  
  21.  
  22. class CategoryListMixin(ContextMixin):
  23. def get_context_data(self, **kwargs):
  24. context = super().get_context_data(**kwargs)
  25. context['current_url'] = self.request.path
  26. return context
  27.  
  28. class MainPageView(TemplateView, CategoryListMixin):
  29. template_name = 'mainpage.html'
  30.  
  31. from generic.mixins import CategoryListMixin
  32.  
  33. from generic.mixins.CategoryListMixin import CategoryListMixin
Add Comment
Please, Sign In to add comment