From a63e3389692bbc823165f1330170038b03a29e3a Mon Sep 17 00:00:00 2001 From: Viggo de Vries Date: Thu, 26 Sep 2024 11:39:29 +0200 Subject: [PATCH] We need to specify the path depth and numchild because name, description and slug should be updated afterwards --- oscarapi/utils/categories.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oscarapi/utils/categories.py b/oscarapi/utils/categories.py index de4fddba..cc845264 100644 --- a/oscarapi/utils/categories.py +++ b/oscarapi/utils/categories.py @@ -126,7 +126,7 @@ def _upsert_categories(data, parent_category=None): category.move(parent_category, pos="first-child") # Update the category to make it aware of it's new home after moving - category.refresh_from_db() + category.refresh_from_db(fields=["path", "depth", "numchild"]) # The category is now the sibling, new categories will be moved to the right of this category sibling = category