Merge branch 'master' of http://210.77.77.77/xieshen/newmediamonitoring
This commit is contained in:
commit
42c9f4ee9c
|
@ -16,6 +16,7 @@ urlpatterns = [
|
|||
path('notices/read/', views.read_notice, name='polls_read_notice'),
|
||||
path('medias/create/', views.create_media, name='polls_add_media'),
|
||||
path('medias/list/', views.medias, name='polls_medias'),
|
||||
path('news/list/', views.news_list, name='polls_news'),
|
||||
path('news/detail/', views.news_detail, name='polls_news_detail'),
|
||||
path('monitor/statistics/', views.monitor_statistics, name='polls_monitor_statistics')
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from .user import index, status_500, status_401, polls_login, send_code, register_step_one, register_step_two, password_recover_step_one, password_recover_step_two
|
||||
from .notice import notices, read_notice
|
||||
from .media import medias, create_media
|
||||
from .news import news_detail
|
||||
from .monitor import monitor_statistics
|
||||
from .news import news_list, news_detail
|
||||
from .monitor import monitor_statistics
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,4 +1,20 @@
|
|||
from django.shortcuts import render
|
||||
from dashboard.models import News
|
||||
from django.http import JsonResponse
|
||||
|
||||
def news_list(request):
|
||||
category = request.GET.get('category','1')
|
||||
news_list = News.objects.filter(type=category)
|
||||
results = []
|
||||
for o in news_list:
|
||||
result = dict()
|
||||
result['id'] = o.id
|
||||
result['title'] = o.title
|
||||
result['author'] = o.author
|
||||
result['content'] = o.content
|
||||
result['date'] = o.date
|
||||
results.append(result)
|
||||
return JsonResponse(results, safe=False)
|
||||
|
||||
def news_detail(request):
|
||||
return render(request, 'polls/news_detail.html')
|
||||
|
|
Loading…
Reference in New Issue