Skip to content

Commit

Permalink
Turn on overriding of django widget templates
Browse files Browse the repository at this point in the history
  • Loading branch information
hmpf committed Jan 17, 2025
1 parent bfa8920 commit 28641b0
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 29 deletions.
4 changes: 4 additions & 0 deletions src/argus/htmx/appconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
"argus.htmx.middleware.HtmxMessageMiddleware": "end",
},
},
{
"app_name": "django.forms",
"settings": {"FORM_RENDERER": "django.forms.renderers.TemplatesSetting"},
},
]

APP_SETTINGS = ListAppSetting(_app_settings).root
33 changes: 4 additions & 29 deletions src/argus/htmx/static/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2104,12 +2104,6 @@ input.tab:checked + .tab-content,
color: var(--fallback-a,oklch(var(--a)/var(--tw-text-opacity)));
}

.btm-nav > *:where(.active) {
border-top-width: 2px;
--tw-bg-opacity: 1;
background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity)));
}

.btm-nav > * .label {
font-size: 1rem;
line-height: 1.5rem;
Expand Down Expand Up @@ -3332,13 +3326,6 @@ details.collapse summary::-webkit-details-marker {
background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity)));
}

.table-zebra tr.active,
.table-zebra tr.active:nth-child(even),
.table-zebra-zebra tbody tr:nth-child(even) {
--tw-bg-opacity: 1;
background-color: var(--fallback-b3,oklch(var(--b3)/var(--tw-bg-opacity)));
}

.table :where(thead tr, tbody tr:not(:last-child), tbody tr:first-child:last-child) {
border-bottom-width: 1px;
--tw-border-opacity: 1;
Expand Down Expand Up @@ -3469,22 +3456,6 @@ details.collapse summary::-webkit-details-marker {
}
}

.btm-nav-xs > *:where(.active) {
border-top-width: 1px;
}

.btm-nav-sm > *:where(.active) {
border-top-width: 2px;
}

.btm-nav-md > *:where(.active) {
border-top-width: 2px;
}

.btm-nav-lg > *:where(.active) {
border-top-width: 4px;
}

.btn-xs {
height: 1.5rem;
min-height: 1.5rem;
Expand Down Expand Up @@ -4197,6 +4168,10 @@ details.collapse summary::-webkit-details-marker {
display: table;
}

.contents {
display: contents;
}

.hidden {
display: none;
}
Expand Down
28 changes: 28 additions & 0 deletions src/argus/htmx/templates/django/forms/div.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% if errors and not fields %}
<div>
{% for field in hidden_fields %}{{ field }}{% endfor %}
</div>
{% endif %}
{% for field, errors in fields %}
<div {% with classes=field.css_classes %}
{% if classes %}class="{{ classes }}"{% endif %}
{% endwith %}>
{% if field.use_fieldset %}
<fieldset>
{% if field.label %}{{ field.legend_tag }}{% endif %}
{% else %}
{% if field.label %}{{ field.label_tag }}{% endif %}
{% endif %}
{% if field.help_text %}<div class="helptext">{{ field.help_text|safe }}</div>{% endif %}
<div>{{ field }}</div>
<div>{{ errors }}</div>
{% if field.use_fieldset %}</fieldset>{% endif %}
{% if forloop.last %}
{% for field in hidden_fields %}{{ field }}{% endfor %}
{% endif %}
</div>
{% endfor %}
{{ errors }}
{% if not fields and not errors %}
{% for field in hidden_fields %}{{ field }}{% endfor %}
{% endif %}

0 comments on commit 28641b0

Please sign in to comment.