From 3d28e60af7f9ef540b19ce81f4e78c0eb7b5e540 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr>
Date: Tue, 14 Jan 2025 18:48:57 +0100
Subject: [PATCH] fix: preserve basemap order based on ID

Ensure basemap order is consistent by explicitly ordering by ID.
Previously, updating a basemap in the Django admin moved it to the last position
in the frontend display. This fix maintains the original order after updates.
---
 api/views/base_map.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/api/views/base_map.py b/api/views/base_map.py
index c15d333c..b38b8856 100644
--- a/api/views/base_map.py
+++ b/api/views/base_map.py
@@ -281,7 +281,7 @@ class BaseMapViewset(
         if project_slug:
             queryset = queryset.filter(project__slug=project_slug)
 
-        return queryset
+        return queryset.order_by('id')
 
     @swagger_auto_schema(
         tags=["base-maps"],
-- 
GitLab