From cd71d78b930cf3410d034b0e2dd92aa1a0870e26 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Mon, 30 Jun 2025 21:29:09 +0300 Subject: [PATCH 1/3] Features: 1) None; Fixes: 1) Correct indentation in `api_urls.py` for better readability; 2) Update `.gitignore` to include `.nuxt/`, `.next/`, and `next-env.d.ts` paths; 3) Simplify query formatting in `delete_never_ordered_products` command; Extra: None; --- .gitignore | 5 +++-- core/api_urls.py | 8 +++++++- core/management/commands/delete_never_ordered_products.py | 5 ++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 8892e506..9ca0fda8 100644 --- a/.gitignore +++ b/.gitignore @@ -64,8 +64,9 @@ htmlcov/ .pybuilder/ # Storefronts -nuxt/ -next/ +.nuxt/ +.next/ +next-env.d.ts # Celery celerybeat-schedule diff --git a/core/api_urls.py b/core/api_urls.py index 22f47a02..101b2be6 100644 --- a/core/api_urls.py +++ b/core/api_urls.py @@ -57,7 +57,13 @@ sitemaps = { urlpatterns = [ path("core/", include(core_router.urls)), path( - "sitemap.xml", sitemap_index, {"sitemaps": sitemaps, "sitemap_url_name": "sitemap-detail"}, name="sitemap-index" + "sitemap.xml", + sitemap_index, + { + "sitemaps": sitemaps, + "sitemap_url_name": "sitemap-index" + }, + name="sitemap-index" ), path("sitemap-
.xml", sitemap_detail, {"sitemaps": sitemaps}, name="sitemap-detail"), path("sitemap-
-.xml", sitemap_detail, {"sitemaps": sitemaps}, name="sitemap-detail"), diff --git a/core/management/commands/delete_never_ordered_products.py b/core/management/commands/delete_never_ordered_products.py index 84b1ba97..885eddb3 100644 --- a/core/management/commands/delete_never_ordered_products.py +++ b/core/management/commands/delete_never_ordered_products.py @@ -5,15 +5,14 @@ from core.models import Product CHUNK_SIZE = 5000 + class Command(BaseCommand): help = "Delete Product rows with no OrderProduct, in batches" def handle(self, *args, **options): while True: batch_ids = list( - Product.objects - .filter(orderproduct__isnull=True) - .values_list('pk', flat=True)[:CHUNK_SIZE] + Product.objects.filter(orderproduct__isnull=True).values_list("pk", flat=True)[:CHUNK_SIZE] ) if not batch_ids: break From c7d8fcbe03de035889df302474ee3d854635dd51 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Tue, 1 Jul 2025 00:16:08 +0300 Subject: [PATCH 2/3] Features: 1) Add new sitemap path for detailed section with pagination. Fixes: 1) Replace `DALFRelatedFieldAjax` with `DALFRelatedOnlyField` for vendor stock field. Extra: 1) Minor formatting adjustments in `api_urls.py` for readability. --- core/admin.py | 2 +- core/api_urls.py | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/admin.py b/core/admin.py index 664c9011..46a6ee3c 100644 --- a/core/admin.py +++ b/core/admin.py @@ -245,7 +245,7 @@ class ProductAdmin(FieldsetsMixin, BasicModelAdmin): ("brand", DALFRelatedFieldAjax), ("category", DALFRelatedFieldAjax), ("tags", DALFRelatedFieldAjax), - ("stocks__vendor", DALFRelatedFieldAjax), + ("stocks__vendor", DALFRelatedOnlyField), "created", "modified", ) diff --git a/core/api_urls.py b/core/api_urls.py index 101b2be6..cb323dd8 100644 --- a/core/api_urls.py +++ b/core/api_urls.py @@ -59,14 +59,21 @@ urlpatterns = [ path( "sitemap.xml", sitemap_index, - { - "sitemaps": sitemaps, - "sitemap_url_name": "sitemap-index" - }, - name="sitemap-index" + {"sitemaps": sitemaps, "sitemap_url_name": "sitemap-detail"}, + name="sitemap-index", + ), + path( + "sitemap-
.xml", + sitemap_detail, + {"sitemaps": sitemaps}, + name="sitemap-detail", + ), + path( + "sitemap-
-.xml", + sitemap_detail, + {"sitemaps": sitemaps}, + name="sitemap-detail", ), - path("sitemap-
.xml", sitemap_detail, {"sitemaps": sitemaps}, name="sitemap-detail"), - path("sitemap-
-.xml", sitemap_detail, {"sitemaps": sitemaps}, name="sitemap-detail"), path("download//", download_digital_asset_view, name="download_digital_asset"), path("search/", GlobalSearchView.as_view(), name="global_search"), path("app/cache/", CacheOperatorView.as_view(), name="cache_operator"), From 7f9673451a848804e3d1c5fbe2a92335b1a53192 Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Tue, 1 Jul 2025 00:20:19 +0300 Subject: [PATCH 3/3] Fixes: 1) Corrected `sitemap_url_name` to include "core:" prefix in `sitemap.xml` path definition; Extra: 1) Improved readability by reformatting dictionary syntax. --- core/api_urls.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/api_urls.py b/core/api_urls.py index cb323dd8..da873ef7 100644 --- a/core/api_urls.py +++ b/core/api_urls.py @@ -59,7 +59,10 @@ urlpatterns = [ path( "sitemap.xml", sitemap_index, - {"sitemaps": sitemaps, "sitemap_url_name": "sitemap-detail"}, + { + "sitemaps": sitemaps, + "sitemap_url_name": "core:sitemap-detail", + }, name="sitemap-index", ), path(