site_tps/settings/views.py
2018-01-31 11:53:37 +01:00

14 lines
635 B
Python

from django.views.generic import TemplateView
from content.models import Category
from users.models import SchoolProfile
from .models import ContentSettings, SiteSettings
class SettingsView(TemplateView):
template_name = "settings/settings.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['categories'] = Category.objects.all()
context['site_settings'],_ = SiteSettings.objects.get_or_create()
context['content_settings'],_ = ContentSettings.objects.get_or_create()
context['schools'] = SchoolProfile.objects.all()
return context