From a968ffe643921388a0d7fa49b7862aae2f787816 Mon Sep 17 00:00:00 2001 From: anurag singh Date: Tue, 21 May 2024 15:43:20 +0530 Subject: [PATCH 1/4] updated swiper view by 6 enteries --- .../core/__pycache__/views.cpython-312.pyc | Bin 6244 -> 6244 bytes newsaggregator/core/views.py | 2 +- .../templates/components/swiperjs.html | 2 +- requirements.txt | 19 ++++++++++++++++-- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/newsaggregator/core/__pycache__/views.cpython-312.pyc b/newsaggregator/core/__pycache__/views.cpython-312.pyc index eddfc04174811665e37a6b7cbdaa901ae06aab02..520d54bfb179e5e361e997ba49956405fa5bf140 100644 GIT binary patch delta 26 gcmaE2@Wg=YG%qg~0}ylaXb!C#N(&0Bh(5(*OVf diff --git a/newsaggregator/core/views.py b/newsaggregator/core/views.py index 3e7d5f3..a0a7593 100644 --- a/newsaggregator/core/views.py +++ b/newsaggregator/core/views.py @@ -53,7 +53,7 @@ def scrape(request, name): def news_list(request): #fetching records stored in Headline model headlines = Headline.objects.all()[::-1]#store records in reverse order - swiper = Headline.objects.all()[:4] + swiper = Headline.objects.all()[:6] context = { "object_list": headlines, 'swiper':swiper, diff --git a/newsaggregator/templates/components/swiperjs.html b/newsaggregator/templates/components/swiperjs.html index 90e042e..6533981 100644 --- a/newsaggregator/templates/components/swiperjs.html +++ b/newsaggregator/templates/components/swiperjs.html @@ -38,7 +38,7 @@
- {% for record in object_list %} + {% for record in swiper %}
diff --git a/requirements.txt b/requirements.txt index a1dff8f..246c8ea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,30 @@ asgiref==3.7.2 +autopep8==1.6.0 beautifulsoup4==4.12.2 bs4==0.0.1 certifi==2023.7.22 charset-normalizer==3.2.0 -Django==3.2.21 +dj-database-url==0.5.0 +Django==5.0.6 +django-admin-volt==1.0.10 +django-environ==0.8.1 +django-jazzmin==3.0.0 django-social-share==2.3.0 gunicorn==21.2.0 idna==3.4 packaging==23.1 +pillow==10.2.0 +pycodestyle==2.8.0 +PyMySQL==1.1.0 +python-dotenv==1.0.1 +pytz==2021.3 +pyzbar==0.1.9 requests==2.31.0 +setuptools==69.5.1 soupsieve==2.4.1 sqlparse==0.4.4 +str2bool==1.1 +toml==0.10.2 tzdata==2023.3 -urllib3==2.0.4 \ No newline at end of file +urllib3==2.0.4 +whitenoise==5.3.0 From dda069760987054c522f468fc5312b59e4be8d9e Mon Sep 17 00:00:00 2001 From: anurag singh Date: Tue, 21 May 2024 18:00:03 +0530 Subject: [PATCH 2/4] adjusted code removed unwanted code updated bookmark --- .../core/__pycache__/__init__.cpython-312.pyc | Bin 182 -> 182 bytes .../core/__pycache__/admin.cpython-312.pyc | Bin 359 -> 450 bytes .../core/__pycache__/apps.cpython-312.pyc | Bin 484 -> 484 bytes .../core/__pycache__/forms.cpython-312.pyc | Bin 1104 -> 1104 bytes .../core/__pycache__/models.cpython-312.pyc | Bin 223 -> 1561 bytes .../core/__pycache__/urls.cpython-312.pyc | Bin 799 -> 1123 bytes .../core/__pycache__/views.cpython-312.pyc | Bin 6244 -> 8284 bytes newsaggregator/core/admin.py | 5 +- .../core/migrations/0001_initial.py | 34 +++++ .../__pycache__/0001_initial.cpython-312.pyc | Bin 0 -> 1878 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 193 -> 193 bytes newsaggregator/core/models.py | 15 +- newsaggregator/core/urls.py | 5 + newsaggregator/core/views.py | 47 +++++- newsaggregator/db.sqlite3 | Bin 208896 -> 225280 bytes newsaggregator/news/__init__.py | 0 .../news/__pycache__/__init__.cpython-311.pyc | Bin 173 -> 0 bytes .../news/__pycache__/__init__.cpython-312.pyc | Bin 182 -> 0 bytes .../news/__pycache__/admin.cpython-312.pyc | Bin 226 -> 0 bytes .../news/__pycache__/apps.cpython-312.pyc | Bin 484 -> 0 bytes .../news/__pycache__/models.cpython-312.pyc | Bin 833 -> 0 bytes .../news/__pycache__/urls.cpython-312.pyc | Bin 405 -> 0 bytes .../news/__pycache__/views.cpython-312.pyc | Bin 3872 -> 0 bytes newsaggregator/news/admin.py | 3 - newsaggregator/news/apps.py | 6 - .../news/migrations/0001_initial.py | 23 --- newsaggregator/news/migrations/__init__.py | 0 .../__pycache__/0001_initial.cpython-312.pyc | Bin 1063 -> 0 bytes .../__pycache__/__init__.cpython-311.pyc | Bin 184 -> 0 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 193 -> 0 bytes .../news/migrations/__pycache__/urls.py | 6 - newsaggregator/news/models.py | 22 --- newsaggregator/news/tests.py | 3 - newsaggregator/news/urls.py | 12 -- newsaggregator/news/views.py | 134 ------------------ .../__pycache__/__init__.cpython-312.pyc | Bin 192 -> 192 bytes .../__pycache__/settings.cpython-312.pyc | Bin 3439 -> 3433 bytes .../__pycache__/urls.cpython-312.pyc | Bin 580 -> 537 bytes .../__pycache__/wsgi.cpython-312.pyc | Bin 694 -> 694 bytes newsaggregator/newsaggregator/settings.py | 3 +- newsaggregator/newsaggregator/urls.py | 5 - .../templates/components/navbar.html | 4 +- newsaggregator/templates/components/news.html | 46 +++--- .../templates/components/swiperjs.html | 2 +- .../__pycache__/__init__.cpython-312.pyc | Bin 187 -> 187 bytes .../__pycache__/admin.cpython-312.pyc | Bin 635 -> 635 bytes .../__pycache__/apps.cpython-312.pyc | Bin 499 -> 499 bytes .../__pycache__/forms.cpython-312.pyc | Bin 1285 -> 1285 bytes .../__pycache__/models.cpython-312.pyc | Bin 1429 -> 1429 bytes .../__pycache__/urls.cpython-312.pyc | Bin 597 -> 597 bytes .../__pycache__/views.cpython-312.pyc | Bin 3075 -> 3075 bytes .../__pycache__/0001_initial.cpython-312.pyc | Bin 3219 -> 3219 bytes .../__pycache__/__init__.cpython-312.pyc | Bin 198 -> 198 bytes 53 files changed, 128 insertions(+), 247 deletions(-) create mode 100644 newsaggregator/core/migrations/0001_initial.py create mode 100644 newsaggregator/core/migrations/__pycache__/0001_initial.cpython-312.pyc delete mode 100644 newsaggregator/news/__init__.py delete mode 100644 newsaggregator/news/__pycache__/__init__.cpython-311.pyc delete mode 100644 newsaggregator/news/__pycache__/__init__.cpython-312.pyc delete mode 100644 newsaggregator/news/__pycache__/admin.cpython-312.pyc delete mode 100644 newsaggregator/news/__pycache__/apps.cpython-312.pyc delete mode 100644 newsaggregator/news/__pycache__/models.cpython-312.pyc delete mode 100644 newsaggregator/news/__pycache__/urls.cpython-312.pyc delete mode 100644 newsaggregator/news/__pycache__/views.cpython-312.pyc delete mode 100644 newsaggregator/news/admin.py delete mode 100644 newsaggregator/news/apps.py delete mode 100644 newsaggregator/news/migrations/0001_initial.py delete mode 100644 newsaggregator/news/migrations/__init__.py delete mode 100644 newsaggregator/news/migrations/__pycache__/0001_initial.cpython-312.pyc delete mode 100644 newsaggregator/news/migrations/__pycache__/__init__.cpython-311.pyc delete mode 100644 newsaggregator/news/migrations/__pycache__/__init__.cpython-312.pyc delete mode 100644 newsaggregator/news/migrations/__pycache__/urls.py delete mode 100644 newsaggregator/news/models.py delete mode 100644 newsaggregator/news/tests.py delete mode 100644 newsaggregator/news/urls.py delete mode 100644 newsaggregator/news/views.py diff --git a/newsaggregator/core/__pycache__/__init__.cpython-312.pyc b/newsaggregator/core/__pycache__/__init__.cpython-312.pyc index 28ecfd5b862254dd87364f24acb77e29d3e9155a..ab91e71ac0cd24486591995afc32f61eeeecd56c 100644 GIT binary patch delta 19 ZcmdnSxQ&tfG%qg~0}wFQ`ApBhxJokJQAJoXot`TO3aL`PsRNMcICu z?6>$*vJ&&s^YxPR^Gb>`lZu#u`fhP2=NF~w<>sfP<`fsP07Z&eC+@FwOV delta 22 ccmaFD{DhhJG%qg~0}xaae;&PG%qg~0}wFP`K0aL$m`4k07IGup#T5? delta 22 ccmcb>ae;&PG%qg~0}yz2Ij0@n$m`4k07ha3^8f$< diff --git a/newsaggregator/core/__pycache__/models.cpython-312.pyc b/newsaggregator/core/__pycache__/models.cpython-312.pyc index e2a8b1e59f41b4f58c29e8740eb9c71f8fbd3962..3756f9fb26438f319081d6f57f3569221acd5404 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~jEs!;7-WjrfE)mMKptoS diff --git a/newsaggregator/core/__pycache__/urls.cpython-312.pyc b/newsaggregator/core/__pycache__/urls.cpython-312.pyc index bed0f0942a7fa4a9861e74ac52509c73c7412eec..92ffe2ba401ae93e4d92d3b9c393aca678ece86f 100644 GIT binary patch delta 425 zcmbQw_LxKcG%qg~0}yD``=rfeVqka-;=lkel<~P|qq-ntJrhGJV~SuZbCwuP0fJ5u zTEn)Q8Nvsv69%f2K*+;bDI#d>^r2PEs z+{B`6eVfd@603~V#FU)Oywv#26g&M}0x-$=#G;bSl$_!HS8|9hF@WcxXHrNAv2-$y14d5aqSC6PFGl*fkGEJbyt*L*LS(7 X?{dLA<_b&f2XP)=rbg}}P*4K^4W4SV delta 101 zcmaFNF`rHSG%qg~0}xa6~1@%w~`QA5Pt^DkHKKYi6E33jA@KBo&*xcZEVMO6jD`a7bCo@#djBs zQyJk&X6kmDi97p{JY-V)r8Y4gC*zkq_AxWG=G>eniw0Zxl*r520^Iqg*?O^QmK_Ni4`b+nq(el?`k zL~A%*q1I}3(K?{tB(k6inj`AqjKIzzT79&huT|R0wT5T|pHr1+G)g%gR1av4(MF)9 z_er!#Ac{k-TB){rX>F#tID0_tC(AYOlLv*@M-T4f)|PQw_HpaVxUKuR^<~^Po10mw zE*;!Z#%_lz9w?h1QX2QEYuw?NF5K}9xu$2xbzXOcn>PuueootKg?z=RY0jQij9EQp zDEW%l3_WFiLF=e!eMP5Eh8;`{gd*5BJ77MLG7;>)^zMT@g5 zVVd_R3^o;078GsPd=wFmJ7}{t?K(~U)^A-msn_apx43&zXV^OD?x#K0E%z~dEj?vYQ$*i*tL>k(^u5S4H$mwm5 zGw5D=^QThEA-HQmGpn^ifx|zpL$V&B0RgHCVd#xb zOs-8HM2$e5XHCdCh|rACg3yZ4hR}|18etUSb%1a+^IM+<4rPwuN*Liegrf*AAVd&) z5O`p{h*Tc}9viOWCS>0)@wtj)I2{1UyAt|b%4CDMa2#O>0gc9n5xC+X5Hd*EOE~`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IcB~+o_7f%z-MTcDFR+ z*;X;cuqRkMq62}?ht&c2<40%AvSC$g<|&t5zy-D9)I9U9=Z0X`34@J@eKqrrD_+Dd z!F&*Y?uURy@>1cp*2cex7Y_cB@BCHEZ-(WRvUurbgd{SbA6_jS{qE+^@uAhw5F1_D zj;~8f8qP6|uP1xz8I)NBbSq&wgap{Yp4f=svN4Kao|kGKdZ zW?sK`Cx#9p4k5Y#+)3r?MV!5XID!!6>PJ;V2(vU{7JKtmya&~B#9IJATyf@V9z$2y z3B(ZMB;sv^c%E%n(#O*ipC}&aCT)RU88iAf0;kW|I)M~R(wec z(hw)nrQPC$%Tvyr$KHn}gZE^*>FCOMCNG^k1`B@Jw98e?56{jxHIrfD_j47;hAuX1 zo;x6-yN!Ye*cHT8L=XSE@mm__felfZW3P!3G@R(ea>ZjeAa)ym?mvJ<@?7Ie)7FkNBl%n}I>RP$ z!(L0GWnOsjKjRjoac(h2-*qn?aNc{Aj5mGUYy49dnwtDVOnm`h;dww;m28;c9`w5 z1i#T9nEC4IB8ue-?8Sc+;&T%{A?hpa5LXh3E)j-V3d^=5r{R5bmU)KRu!did`xD@W zOetL>U29}`jdX+flXU$?QtPCDjr8&p9jQZqM>=R>^E@R|dbOqh7h2ksBJ|{zOr(Jq Ts5Tq<{f>p$rWB&X;(h-C?T%sR diff --git a/newsaggregator/core/admin.py b/newsaggregator/core/admin.py index 4344a28..602462f 100644 --- a/newsaggregator/core/admin.py +++ b/newsaggregator/core/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin -from news.models import Headline +from core.models import Headline,Bookmark -admin.site.register(Headline) \ No newline at end of file +admin.site.register(Headline) +admin.site.register(Bookmark) \ No newline at end of file diff --git a/newsaggregator/core/migrations/0001_initial.py b/newsaggregator/core/migrations/0001_initial.py new file mode 100644 index 0000000..6b12e6e --- /dev/null +++ b/newsaggregator/core/migrations/0001_initial.py @@ -0,0 +1,34 @@ +# Generated by Django 5.0.6 on 2024-05-21 11:05 + +import django.db.models.deletion +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Headline', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=200)), + ('image', models.URLField(blank=True, null=True)), + ('url', models.TextField()), + ], + ), + migrations.CreateModel( + name='Bookmark', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('headline', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='core.headline')), + ], + ), + ] diff --git a/newsaggregator/core/migrations/__pycache__/0001_initial.cpython-312.pyc b/newsaggregator/core/migrations/__pycache__/0001_initial.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b662fd2060466377620205eb06604c187c27b41 GIT binary patch literal 1878 zcmcgtJ#5=X6ecN(qG;KXRoRx*+D!|?kyJ!>fND@$6jo%}aq6E!{wcx;AZXp0rc9A4 zNhML1ra*>{+3HSRTiAm;)t#~iC{U1y0U8Gs4bUl@0H;fU0zHyatRh;n^oHYm@4okY z_a1*69_9$V{`q=k_jj5g{&Jb#3U-O}3MRfI00Bsa;7R%(M31|>JVh(ZT+_g)AkcUqAeE$yEqwrzZBgSzaF4d3lX>5}`8al+exeFsB9`Ze( z@81u*%q}I-N5ef0jHc^@G8uWxOfGqTr}{nmG>q0id{bJF50Fg{kj=a)8+<=U(Oyot z3ZwsDG$7XRSqfa#R-*WL`<+Z2g;#rTbQ7^Rp$HUNg@}^DBBGWTGBk>aEmIR}IuuO^ z&`?vC8=~G8_F)@^4XDeaB0qpAau@15ngIn>Y(Nw=WmADKp5pr8mf#xVeL;b$WbUCL z)|Mddjo^+Vs{4pmTZ)1LEnUGf+EZqBWvBoHu{ShrAN#_f7IuWs!}RJ+avo zcQ6pZCR71bYi-?aa&)P9T>R&t7!_8vCZ!tge;6+_+j?TB?+niks_| zt6x;sZS`>T09#aw-V_C#z~~@MEY4GYehfmgoE*smq9knbz*PlcEU<#55}Ej)=p-Rw|}|) z^KBvxocy+(-?r}5oI8en$2d)zR_WvU@OFW>1od=Mv!cyTh<0NO;n>DvG3J|F`dqK185Sk|YtMn5od2K5_3mEJ zVi+3gp4T*W*MF1Y*BajQ_1>L-OS7(B&-gV=y<$K0pZ{li9<%P)Hr$!l36Lat&Jg4W be-M}dB+@UL6v;g1oanS2o&KA^jA!Ft`d7p; literal 0 HcmV?d00001 diff --git a/newsaggregator/core/migrations/__pycache__/__init__.cpython-312.pyc b/newsaggregator/core/migrations/__pycache__/__init__.cpython-312.pyc index 8f0cae2749efd3e2a533c280b31fb9f7387e4524..6112167e69da4e0c7007485488235e2f1d96d879 100644 GIT binary patch delta 19 ZcmX@ec#x6%G%qg~0}wFP`Ap>A1^_Pn1f2i? delta 19 ZcmX@ec#x6%G%qg~0}xa1^_X*1rGoK diff --git a/newsaggregator/core/models.py b/newsaggregator/core/models.py index 71a8362..2007c1d 100644 --- a/newsaggregator/core/models.py +++ b/newsaggregator/core/models.py @@ -1,3 +1,16 @@ from django.db import models +from django.conf import settings -# Create your models here. +class Headline(models.Model): + title = models.CharField(max_length=200)#title char(200) + image = models.URLField(null=True, blank=True)#image + url = models.TextField() + def __str__(self): + return self.title + +class Bookmark(models.Model): + user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) + headline = models.ForeignKey(Headline, on_delete=models.CASCADE) + + def __str__(self): + return f"{self.user} - {self.headline.title}" diff --git a/newsaggregator/core/urls.py b/newsaggregator/core/urls.py index c9cedd1..2c7a838 100644 --- a/newsaggregator/core/urls.py +++ b/newsaggregator/core/urls.py @@ -10,4 +10,9 @@ path('advertise/',views.advertise,name='advertise'), path('privacy/',views.privacy,name='privacy'), path('scrape/', views.scrape, name="scrape"), + + # bookmarking + path('bookmark//', views.bookmark_article, name='bookmark_article'), + path('bookmarks/', views.view_bookmarks, name='view_bookmarks'), + path('remove_bookmark//', views.remove_bookmark, name='remove_bookmark'), ] \ No newline at end of file diff --git a/newsaggregator/core/views.py b/newsaggregator/core/views.py index 3c576c5..d6c8019 100644 --- a/newsaggregator/core/views.py +++ b/newsaggregator/core/views.py @@ -1,19 +1,26 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required -from django.http import HttpResponse +from django.http import HttpResponse, JsonResponse from django.shortcuts import render from django.shortcuts import render import requests from django.shortcuts import render, redirect from bs4 import BeautifulSoup as BSoup -from news.models import Headline +from core.models import Headline from datetime import datetime from core.forms import ContactForm from django.template.loader import render_to_string from django.core.mail import send_mail -# Create your views here. + + +from django.contrib.auth.decorators import login_required +from django.shortcuts import render, redirect, get_object_or_404 +from core.models import Headline, Bookmark +from django.contrib import messages +from django.views.decorators.csrf import csrf_exempt + #view for scraping new def scrape(request, name): @@ -51,9 +58,13 @@ def scrape(request, name): @login_required(login_url='userauths:sign-in') def news_list(request): - #fetching records stored in Headline model - headlines = Headline.objects.all()[::-1]#store records in reverse order - swiper = Headline.objects.all()[:6] + # Fetch all headlines + headlines = Headline.objects.all()[::-1] # store records in reverse order + swiper = Headline.objects.all()[:4] + + # Get the list of bookmarked headline IDs for the current user + user_bookmarked_headline_ids = request.user.bookmark_set.values_list('headline_id', flat=True) + context = { "object_list": headlines, 'swiper': swiper, @@ -152,4 +163,28 @@ def privacy(request): return render(request, "core/privacy.html", context) +@login_required +def view_bookmarks(request): + bookmarks = Bookmark.objects.filter(user=request.user) + context = { + 'bookmarks': bookmarks, + } + return render(request, 'core/bookmarks.html', context) + +@csrf_exempt +@login_required(login_url='userauths:sign-in') +def bookmark_article(request, headline_id): + if request.method == 'POST': + headline = Headline.objects.get(id=headline_id) + Bookmark.objects.get_or_create(user=request.user, headline=headline) + return JsonResponse({'status': 'success'}) + return JsonResponse({'status': 'error', 'message': 'Invalid request'}, status=400) + +@csrf_exempt +@login_required(login_url='userauths:sign-in') +def remove_bookmark(request, headline_id): + if request.method == 'POST': + Bookmark.objects.filter(user=request.user, headline_id=headline_id).delete() + return JsonResponse({'status': 'success'}) + return JsonResponse({'status': 'error', 'message': 'Invalid request'}, status=400) \ No newline at end of file diff --git a/newsaggregator/db.sqlite3 b/newsaggregator/db.sqlite3 index dd399bc6f09b776bd9adf486bcec307ead996589..4dbbfcf19b67612b36493767e9b04cfa0d625311 100644 GIT binary patch delta 5753 zcmeHLeQea`8Ml3x++A{a?}e{0TEGNC=%^E)eLmZvg&rY5G)MxZ&6t>iKi01f7GBVTV93Ig&it%RtqmcboOv<6a7kieV`x38l-2(3lmLnqJxl8`&QioTd!(-L01 zJfKl$k(eK;lZel(-Sp;)1R@FacXS55ik?7^pzk6FVbqUA)Q%P+62LAb*Q63*V)1g{ zsXAIJULUEW&9o0(2xXezorw(YO~t<*AC2#d-x>dEd{Oh&=63<+-sYKO`x>Sb69%4~ zcRI5;Os*#rIySL;Jz#uoR4XXf==D)^4-fI#gJWrRynm7#9LL{~CwBLVy{1!>UzTArbeioJ$p%i&* zHF6huWo5X96bUcBpIjDi{{9YqP5WcNJbt{pTG&tKV&TLPvB7)7AjQTFa%1bj zZQgN>Tw2XNOg&F|FPh{`m>|e}mClhWSv~(CwUs2BX32}!2A+9=45vbwXr~uBMea?- zw#IIaeiZ#}^s(su(V=K3Y|gJE(KVR{g6!x@cqh-2DOq2lr5lDF>=wST%2-WF-?>mV!bhNa_!Hyk%3We1l= z41I*x@`B6?(hW~DJ-d5zL%nog|CZjb(``3A`@+gLdZ7PvbK2;2ZDsGdBUJQ`!|c{b zYexrpbfv4PCcXjch7Lbxb11iYM{fW&fkdd-fW2OR_QKFWVGcq>bLCYZMKO z&iP_I2gTuS^eOrW{QVxi42yn_yq8g^b%&p?;Y~ri(Ql*OK`RIC9YMRH0V)iMK7*DJ z(P#0M&16#~rbZu$j5KyP7~x!~k9wFa5%Ch* z52MWSVKko)la~B<1DQ+9hqEzoZrXRQ$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zAZ-gZ80vR%v%ESLMR~KwKGxkEiwLi2nk!lqc!4CFtaKDLz74m1Qg)6(I?d;9XgBF zHip6k6y62?Be=G}H44|1|1lR#zKkxTcc4!H3AOu0INT7lA$Zyxrl4&I-!S!ZFg2*- zsbK1YU}{S+HK33p?jw@d5?2zfHw!pq+|2@hvw+_$;5Q5S%>w@aUBLVQrveV2alGUg ga4OkEAR^fW|HiqRfN$Id-u5Vb(-bvRquWL7b-PWaZp-G#rY0?EPL$rd+#L1Wzlhi(0*0q(U zLH9+{)j4d1HazjI1EtD73|x!ya1ZfI%QkQ-I>9d;?X21lb5n;y&TWOuZ^&xU zZi!Yy-S^H~5xOz_0AE87^}%euzRNZ$kj1G5HM*N>he#;4p7J zELl@MBM~2Cs|d!yr@Sp6mkxSDZZ})Cy1bt=c49koK0fwTm$5vjS<>|HE*Dc45!jYA zbB-4cSc`MJ8)#5jGlZ+re$>io;y!9USnHD_SogM7cU&`n7;j)l9 zvoJ~g^?jLGG^V%d8^;^+N6gzNNv%0LNoxG-QQNfSer?-&thx6UQvWbQ9iDnzR#RWQJ9gw7HV6Q?r>%`L~Fn3tVH3I$+5bR>(!z z1WQOHm~=3%L3tBm=F)A_0P)3t8j~dU-JDGxWb+N4wxU8NWH@E1=7*MX#xo) z%+(UnIO#_DwcLO|;8*U4CBA+ImpSP@FfRjDckp``D|1{d;iMR|cm-n>+*`rUchlbD T0YSh#sudwy(dacO&eZ+|S^Pkv diff --git a/newsaggregator/news/__init__.py b/newsaggregator/news/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/newsaggregator/news/__pycache__/__init__.cpython-311.pyc b/newsaggregator/news/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index de7fe454181593c681753fbae17844311d4fb42a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 173 zcmZ3^%ge<80)Oq&K-6Op0RxOs#%DGlV>&|$LokCTqu)w~A|@dJGf486gNs#+dvLJ7 zbBv#Bc(AUcyL*tUyJLudkZwSbzn80XNK9U8d2wQTdQob6Vo81xm>UxxpP83g5+AQu nQ2C3)CO1E&G$+-rh!toc$jV}VAn}2jk&*EO1B@tQ28saySv4o+ diff --git a/newsaggregator/news/__pycache__/__init__.cpython-312.pyc b/newsaggregator/news/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 1057aa87b4859ec4b368fa50fe1a5ed56d4530ee..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 182 zcmX@j%ge<81m~YQrh(|kAOanHW&w&!XQ*V*Wb|9fP{ah}eFmxd73ypi6Iz^FR2<`& zS6Y;qu27trm!1*hl3JWyl3x(x=NcZY>*($tKqc2ms(z&n4Vsg znx0saUj*jH#K&jmWtPOp>lIY~;;_lhPbtkwwJTx;+QJCL#UREpF diff --git a/newsaggregator/news/__pycache__/admin.cpython-312.pyc b/newsaggregator/news/__pycache__/admin.cpython-312.pyc deleted file mode 100644 index 3a15b29fdc0c9e36d3fa279313cd2b882e6ead86..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 226 zcmX@j%ge<81TCe`X-+`;F^B^LOi;#W0U%>KLkdF*V-7mQTYM>5iFxVyddc~DB}JJ@Ma)12D;Yk6)cp!_wu%WYPAw{qam*_%N=#QM z&df{Ch;d0R&MwI>i1Bj`57u>bcMo!PcMS0l(hUgm_i}X(iOEYXFHTHPFG@{MEXgkd rb7R2v=@nG|;;_lhPbtkwwJYKPTEPg!#URE9W=2NFdkhLiY(NeG-U>T< diff --git a/newsaggregator/news/__pycache__/apps.cpython-312.pyc b/newsaggregator/news/__pycache__/apps.cpython-312.pyc deleted file mode 100644 index 41a648a5577aafb4a74891a81bafe7eb713e4be9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 484 zcmXv~O-sW-5Zz5usr?WwBJ?2WMaZE&i--{0TJX?ntq38otnOxwrb)~;NWBUD0pg{< zLHsEm^jHF(1i_n7z4YX666Y}U-p+f=%)FG#1t8+})36^!{gC88av7Ly2`~W!5a@yd zG$8~EXak~*0Z}P@R#Tm+j5Iy>C5aB>MI#6rzGpk^B5kJ`W@NT1zywfWLIO;MKvN}( zsf|=!iwhlk%Tw>&I=R9g^XufiKJW>3d41nuMl|#f9O{x-^Mtgc=i)p<9v)DH;sQcK z8MzXd5W0!5n{_IL+BkBD2n#>5vk!#p3C!eJ^W(;jb;@bTEyIgK%r>~=u}iB-`Ss8b ztWN9fq-M0+y;j@kcYC#?UiYxo=v#6I%veYn9{OQIEgS^A9*jbH!z5_}@Ulo_Fs*LC zX=~Hs%6&7GFG;_nt8p<~R+>Y3)zn^+C=o6RG|%s*`|X9xg35z(dCYGWLii3ge-;#2 Ld8qyZQ4-f5->iLu diff --git a/newsaggregator/news/__pycache__/models.cpython-312.pyc b/newsaggregator/news/__pycache__/models.cpython-312.pyc deleted file mode 100644 index 2832d2419acfa6fe31bf0b910d17c668f1c0350a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 833 zcmY*X&ubGw6rR~1$!62Ey;x%OP!J0dntJdQMF=rQL{mvpge5R+Gt*7d$)?V3w2>Tw z>OeTQ$p_vU+V-kX^(v6v3Hef^c$8$tkn z3TJNWj7-y;4LDSv3#UVq#$O5eckG!BH)u* z$cSLI4-CB%N`^h{2{AFP+vNN+-{x)WP4f^@Vq0#loRmDpZd2;1yVSJztFu=8I)aP2 zrwI;Y&;<=Yd=*N(Vu2S`-MUK&CyGPpo+EPCFG|^TWyc}RsbuUnGp%)}Zd)o?e5Slz+ixKn3lzeWx6fqyOrRoQwJR{jF96pgx;>s z2TRQ&;^rIyJ#ZFX8KsBmZ_2f)=(muJdKyBu*(3;gIzqf$n+m>!(5tpdgB>Qu^&;7t z$sX4U#Vjg(ZKwFmcRjVf2WSWkSYp6GXax6kzJgN@PFaO=JM@!pAkmq)btAatt5kG1%BEz!F*m7u&9)D*hXycym+HRI-Y_`dfZZ@%}S7w=;JNU|#JAIuK~xCaCf=mHN~ z5CWnQ?Du6oQewDPGqO$OL^g5r?5oXLzBFnM-t;4nOsE|!us zEes+mqRi*dU@j!EII5NG6HXbotNxH-XNUKFr)SqGzl?&=ZZ%Gi3)N<`(`Z(^?M~sa z)822?y0*LyI}W1`jsmu%wu~=^qlHoS0y1=Ig>8rg`7ORH+6+MmCm=TgTi<4OZ2am# bGe6DT1ATHI-M8&8wKPL0tK6m8y0HHNya8+C diff --git a/newsaggregator/news/__pycache__/views.cpython-312.pyc b/newsaggregator/news/__pycache__/views.cpython-312.pyc deleted file mode 100644 index 5ea8c8ce907c5478f40e54309fa6cc5dd0f1ebac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3872 zcmd5;-A@}=7N4=lAK2p$u=)Nnu|shaOacjQ*`z52mZnhB4K&$BtkB>YjEz6&oiPx0 zEcqcT8MRVCeE_MuEAJas`Zw%9&=*@yWow#fkv1=Ri<0aMFT3ZAJ+`4lRkbgBr8)PW zbI(2Z-ZST%-~GX6vry3fl%7}>Z4~t{WVEKM3|{jvIG}inr=wJiUZiOp>!P|v9rXIL zET&)7t8ymF#0-l@b!>>5V&+9NjExVe#RlF4)N;y>86;M|0Vw-G=eNATEx)4`BN5`f zK<4~9!hl3E6M+vCAt?E2#rCnlC8h9cGCH3~Zh*l2iNNvEa9jv#Cq^qq`1J6-j)L@n zl2E3$NWGROGgJn3-D7ReR41$qwKPd|&_nKZx$J4wnOv}1uJeS&dy-a^g z{Z*IJ%esg|lh%4!|Claw5ob-RjZ%!{(#A5wGmk5`N*QEBq*tWQGvDyNrE0|tTJ4&hTF;wdH*4K)4RQm|qGHPOmK8Qw zVXs?Zm93GEnni7tV&Agfq1}OZs{7caiuWk0`WNgnE8Catnl0G^T-Eck4Y;bOWqZV{ z>D7A85>0*m4MRy6wHdxq+kKw$H_e?`z7Pd6I35z>(#gA_PnB5uOW30rU?j!5Ak*kfW`IIbAbA=?UronlmX+9p1A z5!`xPVdKKqGM*g^j)=kIIo(d~PK+(#?-!TG<4MAWJYqN=T3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=Dojl!^)}?46izfOaw}d`NDCCT4<&K?I0K)6XdHPn6@I m)ZjC!{~6_ZW$C3mUro{mdi39JiuS!?Xxjgp_0prNz5fDGg)N}~ diff --git a/newsaggregator/news/admin.py b/newsaggregator/news/admin.py deleted file mode 100644 index ea5d68b..0000000 --- a/newsaggregator/news/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/newsaggregator/news/apps.py b/newsaggregator/news/apps.py deleted file mode 100644 index 3e8b1bd..0000000 --- a/newsaggregator/news/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class NewsConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'news' diff --git a/newsaggregator/news/migrations/0001_initial.py b/newsaggregator/news/migrations/0001_initial.py deleted file mode 100644 index dd65f9f..0000000 --- a/newsaggregator/news/migrations/0001_initial.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.2.21 on 2024-05-13 10:52 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Headline', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=200)), - ('image', models.URLField(blank=True, null=True)), - ('url', models.TextField()), - ], - ), - ] diff --git a/newsaggregator/news/migrations/__init__.py b/newsaggregator/news/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/newsaggregator/news/migrations/__pycache__/0001_initial.cpython-312.pyc b/newsaggregator/news/migrations/__pycache__/0001_initial.cpython-312.pyc deleted file mode 100644 index 885aa04ac59d4ca8cbafa9c84e4ab4e211ac1d3e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1063 zcmZuvO-~a+7@pbgF59JGOAwlB&}c(w4Id_+&=6~ZD&fOmiOHtPW?_b9%XV95w@CGZ z2?q}zxPd3nrW`o(6G*&lBT31eh@QAL0b|0+*=;Kvn8Ulz^Um|mzF$AOx@5r4$F20L z!vXNyBkd!!!1)9Ny8rPjI`-;*XO%V0JM6`fuk35`>$ch= ztDMg7ceNvQsDvuriCZ){*X~G`N-wd7OvA#IGte~UUQH%=8q&&6QC%Teb14&g$8X*49zq?U>e%MWVvW#)zS)>3Xb8J`0R-NIssYJwN2H;mhP-kfko?>O+r{U zHEW&nR@pRZpiE5WBZiPwD^dSU1(R?xKf4;oCbX`~6IrN!BnGmAH!CX|aM z+*+6K;M{BEB}$LymRQ|(E@hR8rr);>OJB=PVtd^wmU8n`Z{G~3GMUAxOe(vuIQ)8X zVP-0w%~|-pt?4?!y5U}#d#tt!87WnWx6r=vfc=G;ZE)J%vz2M^uvgrg zZAc(^@3UN&25Qp4N#xFHJ13E-8%ypD)?>+9 zEP1eU92iJcrsrbXXsLT)*Rsk8D!L3a{Deb cjR1u3uLxk`LX1FhN3MtCwQ&3oV8oC92ivg{NdN!< diff --git a/newsaggregator/news/migrations/__pycache__/__init__.cpython-311.pyc b/newsaggregator/news/migrations/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index c6334fee5eab3d1f7aa59a03d0a606f69b2a8be8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 184 zcmZ3^%ge<80)Oq&K-6Op0RxOs#%DGlV>&|$LokCTqu)w~A|@dJGf486w~JMbdvLJ7 zbBv#Bc(AUcyL*tUyJLudkZwSbzn80XNK9U8d2wQTdQob6Vo81xm>ZLunO>Awl9``Z y91|a(nU`4-AFo$X`HRCQH$SB`C)KWq6=*id_F{e@@qw9st diff --git a/newsaggregator/news/migrations/__pycache__/__init__.cpython-312.pyc b/newsaggregator/news/migrations/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 6356d4a502861dfbbc9304b72103be8d09f90e77..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 193 zcmX@j%ge<81m~YQrh(|kAOanHW&w&!XQ*V*Wb|9fP{ah}eFmxdmEdd@6Iz^FR2<`& zS6Y;qu27trm!1*hl3JWyl3x(x=NcZY>*($tKqc2ms(z&n4Vsg znx0saUj*jHu*uC&Da}c>D`Ev&$Oy#6AjU^# LMn=XWW*`dyFKsjk diff --git a/newsaggregator/news/migrations/__pycache__/urls.py b/newsaggregator/news/migrations/__pycache__/urls.py deleted file mode 100644 index bfe4676..0000000 --- a/newsaggregator/news/migrations/__pycache__/urls.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.urls import path -from news.views import scrape, news_list -urlpatterns = [ - path('scrape/', scrape, name="scrape"), - path('', news_list, name="home"), -] \ No newline at end of file diff --git a/newsaggregator/news/models.py b/newsaggregator/news/models.py deleted file mode 100644 index 843f075..0000000 --- a/newsaggregator/news/models.py +++ /dev/null @@ -1,22 +0,0 @@ -from django.db import models -from django.conf import settings - - -# Create your models here. - -#create a user model by using Model class -#Headline will be the name of the table -#columns -> title,image,url -class Headline(models.Model): - title = models.CharField(max_length=200)#title char(200) - image = models.URLField(null=True, blank=True)#image - url = models.TextField() - def __str__(self): - return self.title - -class Bookmark(models.Model): - user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) - headline = models.ForeignKey(Headline, on_delete=models.CASCADE) - - def __str__(self): - return f"{self.user} - {self.headline.title}" diff --git a/newsaggregator/news/tests.py b/newsaggregator/news/tests.py deleted file mode 100644 index de8bdc0..0000000 --- a/newsaggregator/news/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/newsaggregator/news/urls.py b/newsaggregator/news/urls.py deleted file mode 100644 index f1792b7..0000000 --- a/newsaggregator/news/urls.py +++ /dev/null @@ -1,12 +0,0 @@ -from django.urls import path -from . import views - -app_name='news' - -urlpatterns = [ - path('scrape/', views.scrape, name="scrape"), - # path('', views.news_list, name="home"), - path('bookmark//', views.bookmark_article, name='bookmark_article'), - path('bookmarks/', views.view_bookmarks, name='view_bookmarks'), - path('remove_bookmark//', views.remove_bookmark, name='remove_bookmark'), -] diff --git a/newsaggregator/news/views.py b/newsaggregator/news/views.py deleted file mode 100644 index 2e97c1d..0000000 --- a/newsaggregator/news/views.py +++ /dev/null @@ -1,134 +0,0 @@ -from django.shortcuts import render -import requests -from django.shortcuts import render, redirect -from bs4 import BeautifulSoup as BSoup -from news.models import Headline - - -from django.http import JsonResponse -from django.views.decorators.csrf import csrf_exempt - -# Create your views here. -#view for scraping new - -def scrape(request, name): - Headline.objects.all().delete() #remove all existing records from table - session = requests.Session() - #useragent helps server to identify origin of request - #we are imitating request as google bot - session.headers = {"User-Agent": "Googlebot/2.1 (+http://www.google.com/bot.html)"} - #google bot is crawler program - #session.headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"} - url = f"https://www.theonion.com/{name}" - content = session.get(url).content - #print(content)#raw content - soup = BSoup(content, "html.parser") - #print(soup) - # finding all new div using common class - News = soup.find_all("div", {"class": "sc-cw4lnv-13 hHSpAQ"}) - print(News) - for article in News: - #extracting news link,img url,title for each news - main = article.find_all("a", href=True) - linkx = article.find("a", {"class": "sc-1out364-0 dPMosf js_link"}) - link = linkx["href"] - titlex = article.find("h2", {"class": "sc-759qgu-0 cvZkKd sc-cw4lnv-6 TLSoz"}) - title = titlex.text - imgx = article.find("img")["data-src"] - #storing extracted data to model - new_headline = Headline() - new_headline.title = title - new_headline.url = link - new_headline.image = imgx - new_headline.save() - #saving details to table - return redirect("../") - - -def news_list(request): - #fetching records stored in Headline model - headlines = Headline.objects.all()[::-1]#store records in reverse order - context = { - "object_list": headlines,} - return render(request, "core/home.html", context) - -# context is a dictionary using which we can pass values to templates from views - - -from django.shortcuts import render - -def about(request): - return render(request, 'about.html') - - -# for breaking home page - -def breakinghome(request): - Headline.objects.all().delete() - session = requests.Session() - session.headers = {"User-Agent": "Googlebot/2.1 (+http://www.google.com/bot.html)"} - url = f"https://www.theonion.com/latest" - content = session.get(url).content - soup = BSoup(content, "html.parser") - - News = soup.find_all("div", {"class": "sc-cw4lnv-13 hHSpAQ"}) - count=0 - for article in News: - count=count+1 - - if count<=8: - main = article.find_all("a", href=True) - - linkx = article.find("a", {"class": "sc-1out364-0 dPMosf js_link"}) - link = linkx["href"] - - titlex = article.find("h2", {"class": "sc-759qgu-0 cvZkKd sc-cw4lnv-6 TLSoz"}) - title = titlex.text - - imgx = article.find("img")["data-src"] - - new_headline = Headline() - new_headline.title = title - new_headline.url = link - new_headline.image = imgx - new_headline.save() ##saving each record to news_headline - - headlines = Headline.objects.all()[::-1] - context = { - "object_list": headlines, - } - - return render(request, "core/home.html", context) - -################################ -############################### -from django.contrib.auth.decorators import login_required -from django.shortcuts import render, redirect, get_object_or_404 -from .models import Headline, Bookmark -from django.contrib import messages - -@login_required -def view_bookmarks(request): - bookmarks = Bookmark.objects.filter(user=request.user) - context = { - 'bookmarks': bookmarks, - } - return render(request, 'core/bookmarks.html', context) - - -@csrf_exempt -@login_required(login_url='userauths:sign-in') -def bookmark_article(request, headline_id): - if request.method == 'POST': - headline = Headline.objects.get(id=headline_id) - Bookmark.objects.get_or_create(user=request.user, headline=headline) - return JsonResponse({'status': 'success'}) - return JsonResponse({'status': 'error', 'message': 'Invalid request'}, status=400) - -@csrf_exempt -@login_required(login_url='userauths:sign-in') -def remove_bookmark(request, headline_id): - if request.method == 'POST': - Bookmark.objects.filter(user=request.user, headline_id=headline_id).delete() - return JsonResponse({'status': 'success'}) - return JsonResponse({'status': 'error', 'message': 'Invalid request'}, status=400) \ No newline at end of file diff --git a/newsaggregator/newsaggregator/__pycache__/__init__.cpython-312.pyc b/newsaggregator/newsaggregator/__pycache__/__init__.cpython-312.pyc index 6fbbed41f81ad068a868b9fb54ef0f2143956bd9..e7ca545f76d005f0e91fdc525054ee7a3c86e9eb 100644 GIT binary patch delta 19 ZcmX@Wcz}`nG%qg~0}!y(`Ap>A3IHzS1e^c> delta 19 ZcmX@Wcz}`nG%qg~0}z~l<~WgiD*!ct1;hXV diff --git a/newsaggregator/newsaggregator/__pycache__/settings.cpython-312.pyc b/newsaggregator/newsaggregator/__pycache__/settings.cpython-312.pyc index 033103a31a8384568870aa42e0ca9c8d1710f94e..0e454b44f4b3c95303e4eeb5b4a5b7f56947cc09 100644 GIT binary patch delta 64 zcmaDa^-_xWG%qg~0}!03_es08k(Zf;k!!Lb%Yx0@S)!R4g*OXx9Asv6n0%GHoSk2Y Sse$j4(&k_u2}Tw>pcVjF)ey=6 delta 69 zcmaDU^sex%8AUepavWr4bew#i XyPRD>h^c|^lgega9tlPkd!Rl5q5cub diff --git a/newsaggregator/newsaggregator/__pycache__/urls.cpython-312.pyc b/newsaggregator/newsaggregator/__pycache__/urls.cpython-312.pyc index 408ddd4c0e9b8f062c4be4868d1aa99dc9aaab36..23ea0c862fffe66c17b645d42a8a113f2a42b2a2 100644 GIT binary patch delta 235 zcmX@YGLwbxG%qg~0}x!U_es0XFp*D!amqw>#d;=&ROS@sRK_f@BuD`QWbq)_FxF}& z2n(!_1xT`_u&!o=h@r@_f#ulI<*ef|SIbVXbXfjT`EHUwm9wWzOWk%h}iHz;~ z{6JxlamB7c;sY}yBja5Lh5HPuAK4gKIXfgKm`=BvXf@q_qWxtS<(n)VlVzA>x!GCx LnHsr^c!4?q`>rNb delta 242 zcmbQqa)gENG%qg~0}$Mt<(#&OaU!1t0u-^~y4VWD(nBbH;8HL7qDQXKLgw;spF diff --git a/newsaggregator/newsaggregator/__pycache__/wsgi.cpython-312.pyc b/newsaggregator/newsaggregator/__pycache__/wsgi.cpython-312.pyc index 957062acdb5e7264df25261b9c91095b8c4a0a4d..3a1080e3d7134cc652dc1c28307b62335ba5b8c9 100644 GIT binary patch delta 20 acmdnSx{a0lG%qg~0}!y(`E2A~%>)250R*T3 delta 20 acmdnSx{a0lG%qg~0}z~l=D3l2H4^|j#|6*; diff --git a/newsaggregator/newsaggregator/settings.py b/newsaggregator/newsaggregator/settings.py index 304701d..ac641a4 100644 --- a/newsaggregator/newsaggregator/settings.py +++ b/newsaggregator/newsaggregator/settings.py @@ -46,10 +46,9 @@ 'django.contrib.staticfiles', # custom apps - 'news', 'django_social_share', - 'core', + # authentication 'userauths', ] diff --git a/newsaggregator/newsaggregator/urls.py b/newsaggregator/newsaggregator/urls.py index 02fb564..51365de 100644 --- a/newsaggregator/newsaggregator/urls.py +++ b/newsaggregator/newsaggregator/urls.py @@ -1,13 +1,8 @@ from django.contrib import admin from django.urls import path, include -from news.views import about # Import the about view urlpatterns = [ path('admin/', admin.site.urls), - # path('', include('news.urls')), # Include the URLs from your app - # path('about/', about, name='about'), # Define the URL pattern for the about page - path('user/',include('userauths.urls')), - path('news/',include('news.urls')), path('',include('core.urls')), ] diff --git a/newsaggregator/templates/components/navbar.html b/newsaggregator/templates/components/navbar.html index 97372c6..963b0c2 100644 --- a/newsaggregator/templates/components/navbar.html +++ b/newsaggregator/templates/components/navbar.html @@ -25,7 +25,7 @@ Home
  • About Us @@ -63,7 +63,7 @@ Home
  • @@ -206,19 +214,19 @@ bookmarkButtons.forEach(button => { const isBookmarked = button.getAttribute('data-bookmarked') === 'true'; if (isBookmarked) { - button.textContent = 'Remove Bookmark'; - button.classList.remove('btn-primary'); - button.classList.add('btn-danger'); - } else { - button.textContent = 'Bookmark'; + button.innerHTML = ''; button.classList.remove('btn-danger'); - button.classList.add('btn-primary'); + button.classList.add('btn-secondary'); + } else { + button.innerHTML = ''; + button.classList.remove('btn-secondary'); + button.classList.add('btn-danger'); } button.addEventListener('click', function() { const headlineId = this.getAttribute('data-id'); const isBookmarkAction = this.textContent.trim() === 'Bookmark'; - const url = isBookmarkAction ? `/news/bookmark/${headlineId}/` : `/news/remove_bookmark/${headlineId}/`; + const url = isBookmarkAction ? `/bookmark/${headlineId}/` : `/remove_bookmark/${headlineId}/`; fetch(url, { method: 'POST', @@ -231,9 +239,9 @@ .then(response => response.json()) .then(data => { if (data.status === 'success') { - this.textContent = isBookmarkAction ? 'Remove Bookmark' : 'Bookmark'; - this.classList.toggle('btn-primary'); + this.innerHTML = isBookmarkAction ? '' : ''; this.classList.toggle('btn-danger'); + this.classList.toggle('btn-secondary'); } else { console.error('Error:', data.message); } diff --git a/newsaggregator/templates/components/swiperjs.html b/newsaggregator/templates/components/swiperjs.html index 6533981..90e042e 100644 --- a/newsaggregator/templates/components/swiperjs.html +++ b/newsaggregator/templates/components/swiperjs.html @@ -38,7 +38,7 @@
    - {% for record in swiper %} + {% for record in object_list %}
    diff --git a/newsaggregator/userauths/__pycache__/__init__.cpython-312.pyc b/newsaggregator/userauths/__pycache__/__init__.cpython-312.pyc index 52385b3675019beeca8e421bfe832a5d25c864ab..8baa861023e0cecc6d600afe8154c4e6a9b5d31d 100644 GIT binary patch delta 19 ZcmdnZxSNstG%qg~0}!y)`Ap>A001sF1djj! delta 19 ZcmdnZxSNstG%qg~0}xa001!B1pNR2 diff --git a/newsaggregator/userauths/__pycache__/admin.cpython-312.pyc b/newsaggregator/userauths/__pycache__/admin.cpython-312.pyc index 6c27b3445c066a2fa3daf1d35d84e4f9fa50038a..778ec4dfc2588c887825f6dbaedbe08cda81c3fc 100644 GIT binary patch delta 22 ccmey(@|%VCG%qg~0}!y)`J`>%$eYIm07_y8761SM delta 22 ccmey(@|%VCG%qg~0}xa?z06=pD^#A|> delta 22 ccmcc0a+QVmG%qg~0}xa?z07QiaYXATM diff --git a/newsaggregator/userauths/__pycache__/views.cpython-312.pyc b/newsaggregator/userauths/__pycache__/views.cpython-312.pyc index 08e87f784cbd25be9dc21826d17d0cf7f77ca093..2b2edb9969073ef7a6292bbf725f34bc5eb8502b 100644 GIT binary patch delta 22 ccmZpcXqMnT&CAQh00iuHK52{_dB1T305@g@DgXcg delta 22 ccmZpcXqMnT&CAQh00ie|I;YueA4FE6G1hD`B delta 19 ZcmX@cc#M(zG%qg~0}xa4FEE61s(tZ From f39c22955f5169837819f51336534fd28f733dfe Mon Sep 17 00:00:00 2001 From: anurag singh Date: Tue, 21 May 2024 19:17:12 +0530 Subject: [PATCH 3/4] added bookmark page fixes #47 --- .../core/__pycache__/urls.cpython-312.pyc | Bin 1123 -> 1123 bytes .../core/__pycache__/views.cpython-312.pyc | Bin 8284 -> 8453 bytes newsaggregator/core/views.py | 8 +- newsaggregator/db.sqlite3 | Bin 225280 -> 225280 bytes newsaggregator/static/assets/css/style.css | 4 +- .../assets/images/bookmarks-animate.svg | 1 + newsaggregator/templates/components/news.html | 36 +- newsaggregator/templates/core/bookmarks.html | 265 ++++++++++++ newsaggregator/templates/core/home.html | 384 ------------------ newsaggregator/templates/core/index.html | 1 + newsaggregator/templates/partials/base.html | 4 +- 11 files changed, 294 insertions(+), 409 deletions(-) create mode 100644 newsaggregator/static/assets/images/bookmarks-animate.svg create mode 100644 newsaggregator/templates/core/bookmarks.html delete mode 100644 newsaggregator/templates/core/home.html diff --git a/newsaggregator/core/__pycache__/urls.cpython-312.pyc b/newsaggregator/core/__pycache__/urls.cpython-312.pyc index 92ffe2ba401ae93e4d92d3b9c393aca678ece86f..f74d6362a1f9a90a837ac4ba2172b9219abf9c8a 100644 GIT binary patch delta 19 ZcmaFN@tA|_G%qg~0}xD}xsfZ91pqjC1rz`P delta 19 ZcmaFN@tA|_G%qg~0}yD`Z{&((0RT011djj! diff --git a/newsaggregator/core/__pycache__/views.cpython-312.pyc b/newsaggregator/core/__pycache__/views.cpython-312.pyc index a004bfb834ac8de81b136503abaa063bc76849e1..313c9fb0eddd6cf8fd9e2a371013ae65e259351c 100644 GIT binary patch delta 972 zcmZXS&rcIU6vubAWm{U>E|el|1FRsHmBil(i6){%CAItz)SytUOLr-2TZ^+x6)m-z z7%v`7CjL0+#h?)(siZgm0ApfIENCzd2Tvv@9v~Xd&g&w^ILUnG&G)@|^Y+cI9KO@# zeD84B7&@Lm>lw@Y7Mu@kXqL>_9&snAh(qLvJ%9!as{MzF3xd)^MqGLBB$xw)=eMJw zLI+<&-T|s;EQKK8PP&vTq|wx*j)x0dYtk%t9u8a}PisG*Fo}DPwO#~40_+DEey~J} zl6hQDCg=s9Jp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b/newsaggregator/core/views.py index d6c8019..6561827 100644 --- a/newsaggregator/core/views.py +++ b/newsaggregator/core/views.py @@ -165,18 +165,20 @@ def privacy(request): @login_required def view_bookmarks(request): - bookmarks = Bookmark.objects.filter(user=request.user) + # Get the list of bookmarked headline IDs for the current user + user_bookmarked_headline_ids = request.user.bookmark_set.values_list('headline_id', flat=True) + bookmarks = Bookmark.objects.filter(user=request.user).select_related('headline') context = { 'bookmarks': bookmarks, + 'user_bookmarked_headline_ids': user_bookmarked_headline_ids, } return render(request, 'core/bookmarks.html', context) - @csrf_exempt @login_required(login_url='userauths:sign-in') def bookmark_article(request, headline_id): if request.method == 'POST': - headline = Headline.objects.get(id=headline_id) + headline = get_object_or_404(Headline, id=headline_id) Bookmark.objects.get_or_create(user=request.user, headline=headline) return JsonResponse({'status': 'success'}) return JsonResponse({'status': 'error', 'message': 'Invalid request'}, status=400) diff --git a/newsaggregator/db.sqlite3 b/newsaggregator/db.sqlite3 index 4dbbfcf19b67612b36493767e9b04cfa0d625311..73f3a2854b3718723aadf60d1f0087e218720332 100644 GIT binary patch delta 175 zcmZp8z}xVEcY-uy_e2?I#_o*?SM?Z$n$7gv&GZ?!o9Q#1`@qA@|AK-42mc5D7yJ*l z3n(yO;5T3sVqsupWZ`8K1k(a+0$^H@jUP-4aWOD3F!R4-;Qz({h5sG@i|v92%y;>f sg;<$^x&*uZWdY0z0KiEkVgLXD delta 171 zcmZp8z}xVEcY-uy$wV1v#*&Q*SM?ZKo6Ypw&GZ?!o9Q#1`@q8>z`(%&0tkOF7;P6& zV7|aVF@QsjjhTgkk+fq_8)NDBgK4j?VS1!RDAyyt(<|8lcn!fk$4R%W0KE0|;k j%5t+X0ZCRC6s7OMO2t8n1i(s#z)A(dN(Gh$Fe?B6;z=Iz diff --git a/newsaggregator/static/assets/css/style.css b/newsaggregator/static/assets/css/style.css index 5aebdad..79e772e 100644 --- a/newsaggregator/static/assets/css/style.css +++ b/newsaggregator/static/assets/css/style.css @@ -337,14 +337,14 @@ header .btn-group { .mobile-nav .nav-item { margin-bottom: 0.5rem; } +.bookmark-heading, .mobile-nav .nav-link { font-size: var(--fs-3); color: var(--foreground-secondary); } - +.bookmark-heading:hover, .mobile-nav .nav-link:hover { color: var(--accent); - } diff --git a/newsaggregator/static/assets/images/bookmarks-animate.svg b/newsaggregator/static/assets/images/bookmarks-animate.svg new file mode 100644 index 0000000..2be6516 --- /dev/null +++ b/newsaggregator/static/assets/images/bookmarks-animate.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/newsaggregator/templates/components/news.html b/newsaggregator/templates/components/news.html index 6b46c61..a2b3fe1 100644 --- a/newsaggregator/templates/components/news.html +++ b/newsaggregator/templates/components/news.html @@ -25,9 +25,6 @@ align-items: center; justify-content: center; } - .bookmark-btn{ - - }
    +
    + + +
    + +
    +
    +
    +
    +
    + {% endfor %} + {% else %} + Thier is no bookmarks yet! +
    + +
    + {% endif %} +
    + + + + + + + + +
    + + + + + + + + + +{% endblock index %} diff --git a/newsaggregator/templates/core/home.html b/newsaggregator/templates/core/home.html deleted file mode 100644 index 7f1cd49..0000000 --- a/newsaggregator/templates/core/home.html +++ /dev/null @@ -1,384 +0,0 @@ - - - - News Aggregator - - Login and Register in Header - - - - - - - - - - - - - - - - - - - - - - - - - - {% load social_share %} - -
    -
    -
    -

    Onion News Aggregator

    - - -
    -
    - -
    - {% for record in object_list %} -
    -
    - News Image -
    -
    - {{ record.title }} -
    -

    {{ record.description|truncatechars:100 }}

    -
    - -
    -
    - {% endfor %} -
    - - - - - - - - - - - - - - -
    - - -
    -
    - © 2024 Onion News Aggregator -
    -
    - - - - - - - - diff --git a/newsaggregator/templates/core/index.html b/newsaggregator/templates/core/index.html index c202e76..e7ca504 100644 --- a/newsaggregator/templates/core/index.html +++ b/newsaggregator/templates/core/index.html @@ -11,6 +11,7 @@
    {% endfor %} {% endif %} + {% block index %} {% include 'components/news.html' %} {% endblock index %} diff --git a/newsaggregator/templates/partials/base.html b/newsaggregator/templates/partials/base.html index 01267ee..e6377da 100644 --- a/newsaggregator/templates/partials/base.html +++ b/newsaggregator/templates/partials/base.html @@ -41,7 +41,8 @@ {% load social_share %}
    {% block category %} - {% endblock category %} + {% endblock category %} + {% block index %} @@ -49,6 +50,7 @@ {% endblock authentication %} {% endblock index %} + {% include 'components/footer.html' %} From 1a8a785abfdb3e2a39fa819f6abcb591416de91c Mon Sep 17 00:00:00 2001 From: anurag singh Date: Tue, 21 May 2024 19:54:23 +0530 Subject: [PATCH 4/4] added paginator fixes #57 --- .../core/__pycache__/views.cpython-312.pyc | Bin 8453 -> 9192 bytes newsaggregator/core/views.py | 28 ++++-- newsaggregator/templates/components/news.html | 93 ++++++++++++++++++ 3 files changed, 115 insertions(+), 6 deletions(-) diff --git a/newsaggregator/core/__pycache__/views.cpython-312.pyc b/newsaggregator/core/__pycache__/views.cpython-312.pyc index 313c9fb0eddd6cf8fd9e2a371013ae65e259351c..667071670ce7bc259eb1a6466bffb4cb905431e5 100644 GIT binary patch delta 2515 zcmZuzZ%k8H6u+;pe=XDpZKbrO6e-r{0F^nW;1m=^H|C$o{z%m3(f5F2+lTkPg1ASD zP9qW%HFqC0+cLKgQ=?gC$o661HvQnXEP-_iYYDdr4!3!=QZ*D{yKIqm`3u^zMcV2Yw7x~!NM74; z!(G_8e380_hUj0!uaNxn?g(e9sEaP}h4sM&`$7UMhb?>sX)yi0if47l9-%jp7E~GQ z93`b)vf7&7nO3D<3G0q+sR4Bu#1m0=1Ittr!TN{wWm*YbOFC@pmZ%YGlg4jC{emSsXQJrik41xykRW+at1~`G)1XDPLY{ zi~2cGGH$Zg?5?wlwt~(q+D9y^ckUpN#%K%ctPZ4E$&q5u4$VBD{fJGoX;#gov7+N+ z^N3xoEG$Lh63u>{&GY+EHBx=^x(LD^ChyE!Wn1vIADvyJ`WIQz=E-kq)~x+O@>^-Z zYokVQ522&%el*1J&RxgYx`as1FA1#D%>%TIv(Qkp4hpf%6mmA;>01p7vQg@^?sTf43U_0e`2X4$7@;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