Skip to content

Commit

Permalink
修复版本,代下一版本重构
Browse files Browse the repository at this point in the history
  • Loading branch information
冯金琪 authored and 冯金琪 committed Aug 3, 2020
1 parent 6ee8213 commit e89aac0
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 210 deletions.
3 changes: 3 additions & 0 deletions apps/article/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
app_name='article'
from . import views
urlpatterns = [

path('', views.ArticleList, name='index'),

path('created/',views.Article_Add,name='created'),
path('me/',views.ArticleMe,name='me'),
path('',views.ArticleList,name='index'),
Expand Down
35 changes: 33 additions & 2 deletions apps/article/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,37 @@
from pure_pagination import Paginator, PageNotAnInteger


def Home(request):
"""
首页
:param request:
:return:
"""
recommend = Recommend.objects.filter(is_recommend=True)[:10]
#seo_list = get_object_or_404(Seo, name='首页')
qq = QQ.objects.all()
links = link.objects.all()
#user = Follow.objects.values('follow_id').distinct().order_by('-follow_id')
# user = Follows.objects.values('follow_id').distinct().order_by('-follow_id')
# item=[]
# for i in user:
# data={}
# #print(User.objects.filter(follow__follow__id=i['follow_id']))
# data['data']=User.objects.filter(follow__follow__id=i['follow_id']).distinct()
# item.append(data)
try:
page = request.GET.get('page',1)
if page == '':
page = 1
except PageNotAnInteger:
page = request.GET.get('page')
# Provide Paginator with the request object for complete querystring generation
article = Article.objects.filter(is_show=True)
p = Paginator(article,10,request=request)
people = p.page(page)
banners = Banners.objects.first()
return render(request, 'pc/index.html', {'article':people,'qq':qq,'recommend':recommend,'links':links,'banners':banners})



def ArticleList(request):
Expand All @@ -45,7 +76,7 @@ def ArticleList(request):
:param request:
:return:
"""
seo_list = get_object_or_404(Seo, name='文章')
# seo_list = get_object_or_404(Seo, name='文章')
article = Article.objects.filter(is_show=True)
category = Category_Article.objects.all().order_by('order')
type = request.GET.get('type', '')
Expand All @@ -63,7 +94,7 @@ def ArticleList(request):

headlines = Headlines.objects.all()[:30]
banners = Banners.objects.first()
return render(request, 'pc/article.html', {'seo_list':seo_list,'article': people,'category':category,'Headlines':headlines,'banners':banners})
return render(request, 'pc/article.html', {'article': people,'category':category,'Headlines':headlines,'banners':banners})



Expand Down
4 changes: 2 additions & 2 deletions apps/course/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
def List(request):
"""TODO 教程列表 a标签根据uuid进 Detail视图渲染对应的所有文章"""
course = Courses.objects.all()
seo_list =get_object_or_404(Seo,name='教程')
return render(request,'pc/course/index.html',{'course':course,'seo_list':seo_list})
#seo_list =get_object_or_404(Seo,name='教程')
return render(request,'pc/course/index.html',{'course':course})


def Detail(request,course_id,list_id):
Expand Down
2 changes: 1 addition & 1 deletion apps/forum/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def index(request):
:param request:
:return:
"""
seo_list = get_object_or_404(Seo, name='社区论坛')
#seo_list = get_object_or_404(Seo, name='社区论坛')
plate = Forum_plate.objects.all()
forum = Forum.objects.filter(hidden=False).exclude(priority=Priority.objects.first())
zd = Priority.objects.all()
Expand Down
Loading

0 comments on commit e89aac0

Please sign in to comment.