From febd3f2cacd7455ac00a47f682f197809d645fa2 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 8 Jan 2023 22:45:01 -0500 Subject: [PATCH] adjust attachment path --- catalog/common/utils.py | 4 ++-- catalog/management/commands/index.py | 9 ++++++++- catalog/views.py | 1 - 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/catalog/common/utils.py b/catalog/common/utils.py index 6fae443f..fd9178c6 100644 --- a/catalog/common/utils.py +++ b/catalog/common/utils.py @@ -16,7 +16,7 @@ def resource_cover_path(resource, filename): + "." + filename.split(".")[-1] ) - return "item/" + resource.id_type + "/" + fn + return "item/" + fn def item_cover_path(item, filename): @@ -26,4 +26,4 @@ def item_cover_path(item, filename): + "." + filename.split(".")[-1] ) - return "item/" + item.category + "/" + fn + return "item/" + fn diff --git a/catalog/management/commands/index.py b/catalog/management/commands/index.py index 91351677..3d261f43 100644 --- a/catalog/management/commands/index.py +++ b/catalog/management/commands/index.py @@ -57,7 +57,14 @@ class Command(BaseCommand): pg = Paginator(qs.order_by("id"), BATCH_SIZE) for p in tqdm(pg.page_range): items = list( - map(lambda o: Indexer.obj_to_dict(o), pg.get_page(p).object_list) + map( + lambda o: Indexer.obj_to_dict(o), + [ + x + for x in pg.get_page(p).object_list + if x.__class__ != CatalogCollection + ], + ) ) if items: Indexer.replace_batch(items) diff --git a/catalog/views.py b/catalog/views.py index 963394c6..e1bc3e24 100644 --- a/catalog/views.py +++ b/catalog/views.py @@ -69,7 +69,6 @@ def retrieve(request, item_path, item_uuid): if request.user.is_authenticated: visible = query_visible(request.user) mark = Mark(request.user, item) - _logger.info(mark.rating) review = mark.review collection_list = ( item.collections.all()