From 101c0fffa49d43973f1adb9d12a3f6fe1f0a4883 Mon Sep 17 00:00:00 2001
From: Kangmin Lee <dlrkdals421@ajou.ac.kr>
Date: Mon, 6 Jun 2022 10:29:17 +0000
Subject: [PATCH] =?UTF-8?q?=08=EA=B2=8C=EC=8B=9C=ED=8C=90=20=EB=B6=84?=
 =?UTF-8?q?=EB=A5=98=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 campics_/jinstagram/views.py | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/campics_/jinstagram/views.py b/campics_/jinstagram/views.py
index 41bdb62..59f60df 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 = []
-- 
GitLab