site_tps/settings/views.py

13 lines
539 B
Python
Raw Normal View History

2018-01-30 20:39:44 +00:00
from django.views.generic import TemplateView
from content.models import Category
from .models import ContentSettings, SiteSettings
2018-01-14 12:19:11 +00:00
2018-01-30 20:39:44 +00:00
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()
return context