From b43a9d8d0f8b1058c48b1f7009dc16743c7125b3 Mon Sep 17 00:00:00 2001 From: parsch Date: Thu, 22 Aug 2024 12:12:27 +0200 Subject: [PATCH] dynamic dashboard columns 18c76e9e9685830df7e4aeb2549a0cebec26dc68 --- .../grappelli/dashboard/dashboard.html | 47 ++++++++++--------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/grappelli/dashboard/templates/grappelli/dashboard/dashboard.html b/grappelli/dashboard/templates/grappelli/dashboard/dashboard.html index d6c3a909f..cfe9fbb82 100644 --- a/grappelli/dashboard/templates/grappelli/dashboard/dashboard.html +++ b/grappelli/dashboard/templates/grappelli/dashboard/dashboard.html @@ -3,25 +3,30 @@ {{ dashboard.media }}
-
- {% for module in dashboard.children %} - {% if module.column == 1 %} - {% grp_render_dashboard_module module forloop.counter %} + {% with ''|ljust:dashboard.columns as range %} + {% with '0' as outer_counter %} + {% for _ in range %} + {% with outer_counter|add:'1' as outer_counter %} +
-
- {% for module in dashboard.children %} - {% if module.column == 2 %} - {% grp_render_dashboard_module module forloop.counter %} - {% endif %} - {% endfor %} -
-
- {% for module in dashboard.children %} - {% if module.column == 3 %} - {% grp_render_dashboard_module module forloop.counter %} - {% endif %} - {% endfor %} -
-
+ id="column_{{outer_counter}}" + > + {% for module in dashboard.children %} + {% if module.column == outer_counter %} + {% grp_render_dashboard_module module forloop.counter %} + {% endif %} + {% endfor %} +
+ {% endwith %} + {% endfor %} + {% endwith %} + {% endwith %} +
\ No newline at end of file