+
{% for spec in cl.filter_specs %}
- {% jazzmin_list_filter cl spec %}
+
+ {% jazzmin_list_filter cl spec %}
+
{% endfor %}
{% endif %}
{# ---------------------------------------- #}
{% if cl.search_fields %}
-
diff --git a/static/css/custom.css b/static/css/custom.css
index 263cf93..4350e87 100644
--- a/static/css/custom.css
+++ b/static/css/custom.css
@@ -179,7 +179,7 @@ body.model-platformprofile label[for="id_admin_panel_logo"] {
border-bottom: 1px solid #f0f0f0;
}
-/* --- Fix Admin Search Box Layout (Backup for overridden template) --- */
+/* --- Fix Admin Search Box & Filter Layout --- */
/* Target the search form container in Jazzmin/AdminLTE */
#changelist-search .input-group {
@@ -199,3 +199,18 @@ body.model-platformprofile label[for="id_admin_panel_logo"] {
#changelist-search .btn {
white-space: nowrap !important;
}
+
+/* Force filters to sit nicely in a row */
+.filter-wrapper .form-group,
+.filter-wrapper select,
+.filter-wrapper .select2-container {
+ margin-bottom: 0 !important;
+ display: inline-block !important;
+ width: auto !important;
+}
+
+/* Fix for Date Range Inputs if they appear */
+.admindatefilter .controls {
+ display: inline-flex !important;
+ align-items: center !important;
+}
\ No newline at end of file
diff --git a/static/js/admin_date_range_dropdown.js b/static/js/admin_date_range_dropdown.js
index 80b92ae..5c66a2b 100644
--- a/static/js/admin_date_range_dropdown.js
+++ b/static/js/admin_date_range_dropdown.js
@@ -9,8 +9,6 @@
}
function initDateRangeDropdown() {
- // Find start date inputs for 'created_at' (or generic generic approach for any range filter)
- // rangefilter inputs typically have names ending in __gte and __lte
var $gteInputs = $('input[name$="__gte"]');
$gteInputs.each(function() {
@@ -19,37 +17,24 @@
var prefix = name.substring(0, name.lastIndexOf('__gte'));
var $lte = $('input[name="' + prefix + '__lte"]');
- if ($lte.length === 0) return; // Not a pair
+ if ($lte.length === 0) return;
- // Find a container to inject the dropdown.
- // In Jazzmin/Standard, this might be inside a .admindatefilter div,
- // or just a li, or a div.controls.
- // We'll look for the closest container that seems to wrap the filter.
-
- // Try to find .admindatefilter first
var $container = $gte.closest('.admindatefilter');
if ($container.length === 0) {
- // Fallback for Jazzmin or other themes: closest .card-body or similar?
- // Or just the parent form/div
- $container = $gte.closest('div[data-filter-name], li, .form-row, .card-body');
+ $container = $gte.closest('div[data-filter-name], li, .form-row, .card-body, .filter-wrapper');
}
-
if ($container.length === 0) $container = $gte.parent();
if ($container.data('dropdown-init')) return;
$container.data('dropdown-init', true);
- // Hide the original inputs/controls container
- // We need to be careful not to hide the form itself if it's the main filter form
- // Usually rangefilter puts inputs in a 'controls' div or paragraphs.
var $controls = $gte.closest('.controls');
if ($controls.length === 0) {
- // Try to find the immediate parent if it contains both inputs
$controls = $gte.parent();
}
- // Create Select
- var $select = $('