Scan your whole stack
Are you using django-cards?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v1.9.6
django-cards was last scanned on 29 Nov 2026 at version 1.9.6. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 1.9.6 LATEST | 29 Nov 2026 | No rules fired |
| 1.9.5 | 29 Nov 2026 | No rules fired |
| 1.9.4 | 29 Nov 2026 | No rules fired |
| 1.9.3 | 10 Nov 2026 | Not shown |
| 1.9.2 | 10 Nov 2026 | Not shown |
Findings for v1.9.6. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 1.9.6; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
A Django library for building rich, interactive detail cards in your views — with 30+ display options, AJAX reload, search, export, datatables, and more.
django-cards gives you a Python API to build Bootstrap-styled information cards directly from your Django views. Instead of writing repetitive template HTML, you declare cards and entries in Python:
CardList and CardTreepip install django-cards
Add to INSTALLED_APPS:
INSTALLED_APPS = [
...
'cards',
]
django-cards requires:
Cards render for both, from a template pack per version:
cards/templates/cards/bootstrap4/
cards/templates/cards/bootstrap5/
One setting picks between them, and Bootstrap 4 is the default:
DJANGO_CARDS_TEMPLATE_PACK = 'bootstrap5'
A pack emits only its own version's names, so the rendered page carries no classes the browser
will ignore, and the two are free to diverge where Bootstrap 5 changed more than a name -- the
lightbox close button is the worked example, since Bootstrap 4's .close styles a ×
the markup supplies while Bootstrap 5's .btn-close must be empty and draws its own.
The setting may instead be a dotted path to a callable taking the request and returning a pack name, for a project that has to serve both:
DJANGO_CARDS_TEMPLATE_PACK = 'myapp.bootstrap.pack_for_request'
def pack_for_request(request):
return 'bootstrap5' if request and request.user.is_staff else 'bootstrap4'
A pack name never contains a dot, which is what tells the two forms apart.
What this means when you pass your own classes. Anywhere cards takes a CSS class from you
-- div_css_class, css_class, table_td_css_class, badge, a column's css_class, the
list_class / details_class on CardList -- the string is passed through untouched, so
write it for the version you are on:
# on the bootstrap4 pack # on the bootstrap5 pack
div_css_class='col-6 float-left' div_css_class='col-6 float-start'
css_class='text-right' css_class='text-end'
badge='badge-success' badge='text-bg-success'
The renames worth knowing: float-left/float-right → float-start/float-end,
text-left/text-right → text-start/text-end, ml-*/mr-* → ms-*/me-*,
pl-*/pr-* → ps-*/pe-*, font-weight-bold → fw-bold, badge-* → text-bg-*,
badge-pill → rounded-pill, btn-block → w-100.
Overriding a template still works by the old name. cards/standard/default.html and the
rest are still the paths cards renders, and are still what a project overrides, includes or
names in a CardBase.templates subclass. What sits at each of them now is a one-line
forwarder to the pack, so a file of your own at that path shadows it exactly as before -- and
applies to both packs. To replace one version only, put your file at the pack path instead:
myproject/templates/cards/standard/default.html both packs
myproject/templates/cards/bootstrap5/standard/default.html Bootstrap 5 only
A few class names are not in a template, because they are built in Python or written by
the treegrid's JavaScript: the two badges, the column filter selects, the count beside a
filter value and the gap after a context menu icon. They live in cards.packs.PACK_CLASSES,
one entry per pack, and are picked with the same setting.
One difference is not a rename and cannot be dualled. Bootstrap 4 gave col-* a fixed 15px of
padding; Bootstrap 5 takes it from a --bs-gutter-x variable that .row sets. Card groups are
emitted at the top level rather than inside a .row, so a col-* group that had gutters under
4 sits flush under 5. Add your own spacing -- px-2, or wrap the groups in a .row -- if you
want them back.
jQuery is required, and under Bootstrap 5 the order matters. ajax-helpers already loads
it, so this is normally free -- but Bootstrap 5 dropped jQuery as a dependency and only
registers its jQuery plugin interface if jQuery is already on the page when it loads. Several
cards go through that interface: tooltips and popovers, and the image gallery's lightbox.
Load jQuery before bootstrap.bundle.js.
The rest of the stack is not all there yet. django-menus has the same mechanism, under
its own DJANGO_MENUS_TEMPLATE_PACK -- set both to the same version. django-modals,
django-datatables and crispy's bootstrap4 template pack still emit Bootstrap 4 markup only,
so under Bootstrap 5 your cards will be correct while the modals around them and the
datatables in them are not, until those libraries get the same treatment.
To see the difference, the example app serves either version, and the nav bar carries a toggle that flips between them on the page you are looking at -- no restart:
python manage.py runserver # starts on Bootstrap 4
?bootstrap=5 on any URL does the same thing and sticks for the session.
CARDS_EXAMPLE_BOOTSTRAP=5 in the environment sets where a fresh session starts.
from cards.standard import CardMixin
from django.views.generic import DetailView
class CompanyDetailView(CardMixin, DetailView):
model = Company
template_name = 'company/detail.html'
def setup_cards(self):
card = self.add_card('info', title='Company Info', details_object=self.object)
card.add_entry(field='name')
card.add_entry(field='active')
card.add_entry(field='importance')
self.add_card_group('info', div_css_class='col-12')
{% load django_cards_tags %}
<div class="row">
{{ card_groups }}
</div>
Or render individual cards:
{% load django_cards_tags %}
{% for card in cards.values %}
{% show_card card %}
{% endfor %}
| Constant | Type | Description |
|---|---|---|
CARD_TYPE_STANDARD (1) |
Standard | Label/value detail card (default) |
CARD_TYPE_DATATABLE (2) |
Datatable | Embedded datatable |
CARD_TYPE_ORDERED_DATATABLE (3) |
Ordered Datatable | Datatable with drag-and-drop row ordering |
CARD_TYPE_HTML (4) |
HTML | Arbitrary HTML content |
CARD_TYPE_LIST_SELECTION (5) |
List Selection | Scrollable selectable list panel |
CARD_TYPE_CARD_GROUP (6) |
Card Group | Group of cards with a shared header |
CARD_TYPE_CARD_LAYOUT (7) |
Layout | Headerless nested layout container |
CARD_TYPE_CARD_MESSAGE (8) |
Message | Alert/warning message card |
CARD_TYPE_LINKED_DATATABLES (9) |
Linked Datatables | Side-by-side datatables with drill-down filtering |
CARD_TYPE_ACCORDION (10) |
Accordion | Collapsible panels containing any card type |
CARD_TYPE_PANEL_LAYOUT (11) |
Panel Layout | CSS Grid resizable/collapsible panel regions |
CARD_TYPE_IFRAME (12) |
Iframe | Embedded external URL or inline HTML content |
CARD_TYPE_TREEGRID (13) |
Treegrid | Fancytree hierarchical grid with lazy loading, filters, and editing |
Import constants from cards.base:
from cards.base import (CARD_TYPE_STANDARD, CARD_TYPE_DATATABLE, CARD_TYPE_HTML,
CARD_TYPE_LINKED_DATATABLES, CARD_TYPE_ACCORDION,
CARD_TYPE_PANEL_LAYOUT, CARD_TYPE_IFRAME)
A row's value and label are escaped when the card is drawn, the way {{ }} escapes a
template variable, unless they are marked safe. That covers a value passed in, a field read
off details_object (add_rows('name')), each line of a list value, the default shown
for an empty value and the entry name of a CardList, so stored text reaches the page as
text whoever typed it:
from django.utils.html import format_html
from django.utils.safestring import mark_safe
card.add_rows('name') # escaped
card.add_entry(label='Swatch', value=format_html( # markup, with the colour escaped in it
'<i class="fa fa-square" style="color: #{}"></i>', colour.hex_code))
card.add_entry(label=mark_safe('Width × Height'), value=size)
Markup has to be marked safe where it is made -- mark_safe on a literal, format_html
around data, a rendered template or menu, an html_classes element. Joining safe strings with
an f-string, + or % gives back a plain str, which is then escaped; build the join with
format_html instead.
Some parameters are markup, and are used as they are: html_override, a row style's html,
merge_string and the many-to-many html_barge. What the card puts into them -- the value
for %1%, a row style's {placeholders} (and anything looked up on them, {value[v1]}), each
badge's text, each merged part -- is escaped the same way. Keep data out of the markup itself:
put it in the value or a placeholder rather than writing it into the string.
add_html_entry, add_html_string_entry and HTML cards take markup, as before.
Upgrading to 1.7. Up to 1.6 every value and label was printed with |safe. A value that
was markup in a plain str -- an icon, a   in a price, a <sup> in a label -- now
shows its tags; mark it safe where it is made.
<script>A tree card, a treegrid and a panel layout's linked tables hand their data to JavaScript by
writing JSON into a <script> element. json.dumps is right about JSON but not about the
element: </script> is a legal JSON string, and a browser scans a <script> for its closing
tag before anything reads the JSON. A value holding one would end the script mid-JSON and hand
the rest to the HTML parser.
So these blobs go through cards.base.json_for_script, which writes <, > and & as
ordinary JSON escapes. Nothing is escaped for HTML, because a node title may carry markup
on purpose -- a count badge, an icon -- and jstree renders a node as HTML. The templates
splice the JSON into the script as a JavaScript literal, and the escapes are ordinary string
escapes there too, so jstree gets back exactly the characters the application built.
Fixed in 1.8.1 for the tree card and a panel layout's linked tables. The treegrid blobs
already did this. CardTreeMixin was still on plain json.dumps, so a node title containing
</script> closed the element -- reachable by any application that puts stored text in a tree
node. PanelLayout was too; there the mark_safe sits in Python and panel_layout.html shows
no |safe at all, so searching the templates for one would not have found it. A table_id is
normally a literal in your own code, which is why that half is the lesser of the two.
The tree card's selected id is fixed in 1.8.1 as well. It comes from the url and was written
into two single-quoted JavaScript strings with only HTML escaping, so a link whose pk ended in
a backslash or held a line break left the tree's script a syntax error. It now goes through
escapejs.
The add_entry() method accepts 30+ parameters to control how each row is displayed.
| Parameter | Type | Default | Description |
|---|---|---|---|
value |
any | None |
Direct value to display |
field |
str | None |
Field name on details_object (supports __ traversal, e.g. 'category__name') |
label |
str | None |
Row label (auto-generated from field if omitted) |
default |
str | 'N/A' |
Fallback when value is None or empty |
hidden |
bool | False |
Skip rendering this entry entirely |
hidden_if_blank_or_none |
bool | None |
Hide row if value is blank or None |
hidden_if_zero |
bool | None |
Hide row if value is 0 |
| Parameter | Type | Default | Description |
|---|---|---|---|
link |
str/callable | None |
URL — makes the entire row a hyperlink |
value_link |
str | None |
URL wrapping only the value (not the label) |
auto_link |
bool | False |
Auto-detect URLs and emails in text and make them clickable |
card.add_entry(value='Visit https://example.com for details', label='Website', auto_link=True)
card.add_entry(value='Contact support@example.com', label='Email', auto_link=True)
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.