Django ImportExport: How to remove inline <ins> tag background color in import preview with Jazzmin admin?
I'm using Django with the Jazzmin admin theme and the django-import-export package to bulk import model data through the admin panel.
When importing, the import preview page highlights newly added rows or changed fields using an inline tag like this:
<ins style="background:#e6ffe6;">Paris</ins>
This creates an unwanted green/purple background that conflicts with my custom admin styling.
**What I've tried so far:**
Created
custom_admin.css
at:project/static/admin/css/custom_admin.css
Linked it correctly in
admin.py
:class Media: css = { "all": ("admin/css/custom_admin.css",) } js = ("admin/js/custom_tabs.js",)
Added the following aggressive CSS rule:
.import-preview td ins, tr.row-new td ins, .import-preview td > ins { all: unset !important; background-color: #fff !important; color: #000 !important; display: block !important; text-decoration: none !important; width: 100% !important; }
Ran
collectstatic
and did a full cache refresh (Ctrl+Shift+R)Verified that
custom_admin.css
is loaded correctly via DevTools - Still, the inline stylestyle="background:#e6ffe6"
overrides everything.
What I also attempted:
- Overriding the template
import_preview.html
(placed atproject/templates/import_export/import_preview.html
) with a custom version that removes the<ins>
tag completely and wraps cells in<div>
instead. But the default template still seems to load or my override isn’t being used.
My setup:
- Django 5.1.1.
- django-import-export 3.3.5.
- Jazzmin admin theme.
- Static and template settings are configured properly.
Question:
How can I reliably remove or override the inline <ins style="background:#e6ffe6;">
rendering in the import preview page of django-import-export, when using Jazzmin?
I’m fine with either:
- Overriding the template correctly.
OR
- Forcibly killing the inline background style with CSS.
Any working example or tested solution would be highly appreciated. SCREENSHOT