From 537a96484415af991da9a4f9a72741a5a7920d08 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Thu, 12 Oct 2023 16:00:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B9=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.sqlite3 | Bin 339968 -> 339968 bytes front/src/components/news-list.vue | 12 ++++++------ navigation/views.py | 13 ++++++------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/db.sqlite3 b/db.sqlite3 index b9d6c8a3f4d903750e744b2399e7da408523fc12..45c317c9b3f93d5688d5296daed29d23071f5bed 100644 GIT binary patch delta 607 zcmZ9IO=uHQ5XaxVeY;JvZl-|*T8(xQiXU;a`}U)00!3oAMWOVr7FwzVwW1<^fR_Xj zD@f8(^dXA$pcjSO5@fZ9^i(MIqVymNnu1<>s^G_^2i>k7)H(bZn3?~~f6A-L@@jHo z8`LJ#y-=GQUNRKDZ9wus@I5S9Kagb*nYnVYJtO5n=na~>K5F`-COmA_ScynLiLwq< zs!nnJn|dQkBV=fNpa_S>Eraf!I{WCOfAtWQAZc5+V{*&nws~%BGLH~?S*%Y z5IXLkISBWj?wC;<1UK+IuHzbh!VmZs-{31;#07k*HhldHJWyMdU}*=L@fSB>Ka+xy z=PmRYP_lZZ5A-e|be}X1HDO@&(t<@~&Lows9v_NTdj`d78m3 zgWLL_7AtExw(E3@_dlh*kh&wYjDr1YkJ=OLc-`VF5jLm5lz0(mHPg@)(piM)$Y1fF zq+Q@{*5R(_<-QQSX(c!qP$pm-Br{ja# zye0=OzHU(~ypoL(9D>TANEozV%(gSRv-|iZ%XM-gPln{1bgeM|%`VaO*!FY>{nw}E R6r8}PlXpGt&l_?d{RPnOpqT&w delta 439 zcmXYtJ!n%=6vywm_q>;nM{*K*Lam|?7m4|LFCRz?MYQT5NITc1P{BbLDYQeEr$uy- z*dX;Hf@E>2lr}uWEm0B>iqbAObgCfj;L@pe4pLu&9QY5vbNKP+_=mQCXs?`yO#Q+n zWSX--^5&(Hd!h=`%b*?HEFeVJ7w6Aq#Wj#lho4=ZE2_C7d`Kl2V?xxJd5jN5E$|#) z$l4_A<8y;Y)uUVR?vq%zwpSy(q9#t@sa2njsqH>o#{q6d_VI}H(BfkK*=qY^PZdcO3we2N+I04<+A*F zDz1XPYGBs1CI%BW(-CDxv1!6Lxs}A%#b>(RTXuAyzvxZM^t*_1X#=0Q=@f>)NGC*?78wG7M&oqEZ1NfX zrUP1|I=!MkeWV7xr?>LrCXR6OgS2~h=y^ j --> - +
- + {{x.scores.filter(e=> e.score==true).length}} · - + {{x.scores.filter(e=> e.score==false).length}} · @@ -57,7 +57,7 @@
- + {{x.scores.filter(e=> e.score==true).length}} · - + {{x.scores.filter(e=> e.score==false).length}} · diff --git a/navigation/views.py b/navigation/views.py index dc10db026..a76e593e6 100644 --- a/navigation/views.py +++ b/navigation/views.py @@ -37,17 +37,17 @@ class NewsAPIView(ListAPIView): newsqueryset = newsqueryset[:10] else: newsqueryset =newsqueryset[int(request.GET.get("page"))*int(request.GET.get("selected")):int(request.GET.get("page"))*int(request.GET.get("selected"))+int(request.GET.get("selected"))] + result = [] - print(len(newsqueryset)) + for x in newsqueryset: - - # print(x.get_news.all(), '-----------------------x.get_news.all()') + print(x.author, '--------------------------------------') a=model_to_dict(x) a['link']= str(x.link.url) a['show'] = False a['showComment'] = False a['author'] = model_to_dict(DictEmployee.objects.using('user_directory').get(login=x.author.username)) - a['scores'] = [{"score":y.score, "user":y.author.id} for y in x.get_news.all()] + a['scores'] = [{"score":y.score, "user":y.author.username} for y in x.get_news.all()] a['comment'] = [{"author":model_to_dict(DictEmployee.objects.using('user_directory').get(login=k.author.username)), "cdate":k.cdate, "text":k.text, @@ -56,8 +56,6 @@ class NewsAPIView(ListAPIView): ] result.append(a) - # for y in x.get_news.all(): - # print(y.author.id, '-----------------------x.get_news.all()') if len(newsqueryset) ==1: result[0]['showComment'] = True @@ -75,7 +73,8 @@ class NewsAPIView(ListAPIView): upd.cdate=datetime.now() upd.save() - back = [{"score":y.score, "user":y.author.id} for y in ScoreNews.objects.filter(news_id=request.data['news'])] + for y in ScoreNews.objects.filter(news_id=request.data['news']): + back = [{"score":y.score, "user":y.author.username} for y in ScoreNews.objects.filter(news_id=request.data['news'])] if 'text' in request.data: CommentNews.objects.create(news_id=request.data['news'], author=self.request.user, text=request.data['text'])