diff --git a/campics_/jinstagram/views.py b/campics_/jinstagram/views.py index 41bdb624b2b4073d74b0c700cb940adabfd9c2b9..59f60df4360635e1f3ad6e53de9e98e2141d1ba6 100644 --- a/campics_/jinstagram/views.py +++ b/campics_/jinstagram/views.py @@ -14,19 +14,22 @@ class Main(APIView): if user is None: return render(request, 'user/login.html') - feed_object_list = Feed.objects.filter(univ=user.univ).order_by('-id') - - ##### 게시글 정렬 ##### + ##### 게시판 분류 및 정렬##### + + type = request.GET.get('type', None) order_condition = request.GET.get('order', None) - if order_condition == 'recent': - feed_object_list=Feed.objects.filter(univ=user.univ).order_by('-id') - - if order_condition == 'likesCount': - feed_object_list=Feed.objects.filter(univ=user.univ).order_by('-like_count') + if type == 'photozone': + if order_condition == 'recent': + feed_object_list = Feed.objects.filter(univ=user.univ, type=False).order_by('-id') + if order_condition == 'likesCount': + feed_object_list = Feed.objects.filter(univ=user.univ, type=False).order_by('-like_count') + if type == 'scene': + if order_condition == 'recent': + feed_object_list = Feed.objects.filter(univ=user.univ, type=True).order_by('-id') + if order_condition == 'likesCount': + feed_object_list = Feed.objects.filter(univ=user.univ, type=True).order_by('-like_count') - print(order_condition) - print(feed_object_list) #################### row_feed_list = []