From 83d5daec40e7cdc8affad4dcca9868b15edc4227 Mon Sep 17 00:00:00 2001 From: Keshav Priyadarshi Date: Fri, 3 Jan 2025 17:08:55 +0530 Subject: [PATCH] Use pagination to show package events Signed-off-by: Keshav Priyadarshi --- fedcode/templates/base.html | 8 +++---- fedcode/templates/home.html | 2 +- fedcode/templates/pkg_profile.html | 22 ++++++++++++++++-- fedcode/views.py | 13 ++++++++--- .../static/images/aboutcode_favicon-32x32.png | Bin 0 -> 1420 bytes 5 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 federatedcode/static/images/aboutcode_favicon-32x32.png diff --git a/fedcode/templates/base.html b/fedcode/templates/base.html index 0c3779e..c41c523 100644 --- a/fedcode/templates/base.html +++ b/fedcode/templates/base.html @@ -6,7 +6,7 @@ {% block title %}FederatedCode.io{% endblock %} - + @@ -29,9 +29,9 @@ diff --git a/fedcode/templates/home.html b/fedcode/templates/home.html index 58bd85a..c52bdf9 100644 --- a/fedcode/templates/home.html +++ b/fedcode/templates/home.html @@ -50,7 +50,7 @@

My Packages


{{ note.content }}

- +
diff --git a/fedcode/templates/pkg_profile.html b/fedcode/templates/pkg_profile.html index 814ab9b..e08b39b 100644 --- a/fedcode/templates/pkg_profile.html +++ b/fedcode/templates/pkg_profile.html @@ -19,7 +19,7 @@

-

+

purl-image

@@ -118,7 +118,7 @@

- Updates + Package Events

@@ -136,6 +136,24 @@
+ {% if is_paginated %} + + {% endif %}
diff --git a/fedcode/views.py b/fedcode/views.py index 4019b7b..23d6f20 100644 --- a/fedcode/views.py +++ b/fedcode/views.py @@ -191,9 +191,16 @@ def get_success_url(self): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) - # slug = purl_string - context["purl_notes"] = Note.objects.filter(acct=generate_webfinger(self.kwargs["slug"])) + # Paginate Package updates. + purl_note_paginate_by = 10 + purl_notes = Note.objects.filter(acct=generate_webfinger(self.kwargs["slug"])) + paginator = Paginator(purl_notes, purl_note_paginate_by) + page_number = self.request.GET.get("page") + page_obj = paginator.get_page(page_number) + context["purl_notes"] = page_obj + context["is_paginated"] = purl_notes.count() > purl_note_paginate_by + context["page_obj"] = page_obj context["followers"] = Follow.objects.filter(package=self.object) @@ -324,7 +331,7 @@ class PackageListView(ListView, FormMixin): model = Package context_object_name = "package_list" template_name = "pkg_list.html" - paginate_by = 20 + paginate_by = 30 form_class = SearchPackageForm def get_queryset(self): diff --git a/federatedcode/static/images/aboutcode_favicon-32x32.png b/federatedcode/static/images/aboutcode_favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..1786b3f74c3aa7c6343327217fee862fa310caaa GIT binary patch literal 1420 zcmV;71#|j|P)A*` zgPItkC=ifu1o>(Uk0~hylxh zt-#B`ZeT57zzyJg;3wcXaN7=0osZp+`40oyfIgrf$Z5R+Sh&}py+7{=+BV}M>@HE_$Jqu{;tygy-irs%X;Qg{s}rU%X(9CCnE z6F^;xqz~wpli<_R{uB^mbO4>oMyMwPbm$2`i}s~}z-nu|WiKz=>3WBa0CL*rHHv73 z;rW0{?uU4H5EI7k6dj5Vk=GLC4rPaFhv}FwK3aY?2#K?X_X0yTTee!ZbFDaFO63c{ z3UEu|(`}T-0xEY;$6F_kl=h}yOMg4sYm*lPD(wa(z#O|16I?EMe(Y$xJAFFdI@Hf( zUz&J{!Jx9>z-{1XU|PTbL&BxNE5Hr|123lVTTbO#*|Qf9J$(0WiQJVv=`UyUc7Has zcnCLR34CJUG9>&PvJOq{- zKG;UIc)Ysm!bful&KIir@i*HJpBS{!t3c{6UtIj6w0HEA(*Dep=htV6)*C(ytO5ow za@4XlE+5wF7)HP(a3AQ#EbY!f3h&BUX+?!#<&1ZC9FE>O8(8Ja{_LS?aQiBHqx19V z?WI%RzbR{_T>+JK2HlQjF$;lNup%%eA5A&nKoPhg=J(e2&bq*RQurWLa{<-pUUfje5R9|T+H z&UPT5wbJ%9WskgVe9HUE09_PEGB&p>pt=+2b8Hf`lfY%LabQ9~#^u9XZNYTSIX89A zdqvDiunvQbMz!DY^-g(9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