cms/cmsMain/views.py
2024-08-13 14:41:25 +03:00

18 lines
No EOL
608 B
Python

from django.shortcuts import render, get_object_or_404
from django.views import View
from django import template
from .models import Site, Url, Variable
from django.http import HttpResponse
context = template.Context({})
class MainView(View):
def get(self,request):
site = get_object_or_404(Site,domain=request.META["HTTP_HOST"])
t = template.Template(site.base_page.content)
return HttpResponse(t.render(context))
class PageView(View):
def get(self,request,page):
r = get_object_or_404(Url,path=page)
t = template.Template(r.page.content)
return HttpResponse(t.render(context))