0.0.9 section view
This commit is contained in:
@@ -5,7 +5,7 @@ from django.conf import settings
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
# path('', MainPage, name='main'),
|
||||
path('section/<str:url>/', section_view, name='section_page'),
|
||||
# path('page/<str:url>/', StaticPageView, name='static_page'),
|
||||
# path('test_code', test_code, name='test_code'),
|
||||
]
|
||||
@@ -1,3 +1,34 @@
|
||||
from django.shortcuts import render
|
||||
import json
|
||||
|
||||
# Create your views here.
|
||||
from django.http import HttpResponse, Http404, FileResponse
|
||||
from django.template import loader, RequestContext
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from .models import *
|
||||
from django.conf import settings
|
||||
from GeneralApp.funcs import get_inter_http_respose
|
||||
|
||||
def section_view(request, url):
|
||||
|
||||
try:
|
||||
page = Section.objects.get(url=url)
|
||||
|
||||
|
||||
# from ArticlesApp.models import ArticleModel
|
||||
# arts = ArticleModel.objects.filter(enable=True).order_by('-createDT')[:4]
|
||||
|
||||
Dict = {
|
||||
'page': page,
|
||||
# 'articles': arts,
|
||||
}
|
||||
|
||||
# breadcrumbs_Dict = {
|
||||
# }
|
||||
# Dict.update({'breadcrumbs': breadcrumbs_Dict})
|
||||
|
||||
t = loader.get_template('pages/p_section.html')
|
||||
return get_inter_http_respose(t, Dict, request)
|
||||
|
||||
except Exception as e:
|
||||
msg = f'section_view Error = {str(e)}'
|
||||
print(msg)
|
||||
return HttpResponse(msg, status=400)
|
||||
|
||||
Reference in New Issue
Block a user