You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
672 B

import djconfig
from django.contrib.auth.mixins import LoginRequiredMixin
class CabinetViewMixin(LoginRequiredMixin):
title = 'No title'
sidebar_section = None
def get_sidebar_section(self):
return self.sidebar_section
def get_title(self):
return self.title
def get_context_data(self, **kwargs):
ctx = super(CabinetViewMixin, self).get_context_data(**kwargs)
ctx['title'] = self.get_title()
ctx['sidebar_section'] = self.get_sidebar_section()
return ctx
def cabinet_context_processor(ctx):
return {
'admin_configs': {form.slug: form.title for form in djconfig.config._registry},
}