rustango 0.40.0

Django-shaped batteries-included web framework for Rust: ORM + migrations + auto-admin + multi-tenancy + audit log + auth (sessions, JWT, OAuth2/OIDC, HMAC) + APIs (ViewSet, OpenAPI auto-derive, JSON:API) + jobs (in-mem + Postgres) + email + media (S3 / R2 / B2 / MinIO + presigned uploads + collections + tags) + production middleware (CSRF, CSP, rate-limiting, compression, idempotency, etc.).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
<style>
* { box-sizing: border-box; }
body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  margin: 0;
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-fg);
}
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
aside.sidebar {
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border);
  padding: var(--space-5) var(--space-4);
  font-size: 0.9em;
}
aside.sidebar img.brand-logo {
  /* See _op_styles.html for the flex `min-height: auto` rationale (#73). */
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
  align-self: flex-start;
  object-fit: contain;
  margin: 0 0 var(--space-3) 0;
}
aside.sidebar h2 {
  margin: 0 0 var(--space-1) 0;
  font-size: 1.1rem;
  color: var(--color-accent);
  letter-spacing: 0.03em;
}
aside.sidebar p.subtitle {
  margin: 0 0 var(--space-5) 0;
  font-size: 0.85em;
  color: var(--color-fg-muted);
}
aside.sidebar h3 {
  margin: var(--space-4) 0 0.35rem 0;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-fg-subtle);
  font-weight: var(--font-weight-bold);
}
aside.sidebar ul { list-style: none; padding: 0; margin: 0; }
aside.sidebar li { margin: 0.15rem 0; }
/* Sidebar nav links — Home / Activity / model items. The
   `:not(.btn)` carve-out keeps `.btn` / `.btn-link` family
   members (Change password, Logout's POST button, etc.) from
   inheriting the block layout + neutral color, so they render
   with their own variant styling instead. */
aside.sidebar a:not(.btn):not(.btn-link):not(.btn-row-action) {
  display: block;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--color-fg);
  text-decoration: none;
}
aside.sidebar a:not(.btn):not(.btn-link):not(.btn-row-action):hover {
  background: var(--color-bg-hover);
}
aside.sidebar a.active {
  background: var(--color-bg-surface);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  box-shadow: var(--shadow-sm);
}
aside.sidebar .empty {
  color: var(--color-fg-subtle);
  font-style: italic;
  font-size: 0.85em;
}
main.content { padding: var(--space-5) var(--space-6); }
nav.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4) 0;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9em;
  color: var(--color-fg-subtle);
}
nav.breadcrumb li + li::before { content: ""; margin-right: 0.35rem; color: var(--color-border-strong); }
nav.breadcrumb a { color: var(--color-fg-subtle); }
nav.breadcrumb a:hover { color: var(--color-accent); text-decoration: none; }
nav.breadcrumb strong { color: var(--color-fg); }
table { border-collapse: collapse; width: 100%; background: var(--color-bg-surface); }
th, td {
  border: 1px solid var(--color-border);
  padding: 0.35rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
th { background: var(--color-bg-sidebar); }
a { color: var(--color-link); text-decoration: none; }
a:hover { text-decoration: underline; }
small { color: var(--color-fg-subtle); font-weight: var(--font-weight-normal); }
em { color: var(--color-fg-subtle); }
input[type=text],
input[type=number],
input[type=date],
input[type=datetime-local],
input[type=search],
textarea {
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-1) 0.4rem;
  font: inherit;
  background: var(--color-bg-input);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}
textarea { min-height: 4rem; }
input:invalid, textarea:invalid { border-color: var(--color-error-border); outline-color: var(--color-error-border); }
input:invalid + small, textarea:invalid + small { color: var(--color-error-fg); }
.error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-error-fg);
}
.muted { color: var(--color-fg-subtle); }
.search { display: flex; gap: var(--space-2); align-items: center; margin: var(--space-2) 0; }
.search input[type=search] { flex: 1; }
.active-filters { color: var(--color-fg-muted); font-size: 0.9em; margin: var(--space-2) 0; }
.active-filters code {
  background: var(--color-info-bg);
  color: var(--color-info-fg);
  padding: 0.1rem 0.35rem;
  border-radius: var(--radius-sm);
}
.pager { margin-top: var(--space-4); }

/* --------------------------------------------------------------------
   Button + link-button system (#253 follow-up — admin UX
   consolidation). Mirrors the operator console's `.btn` family in
   `_op_styles.html` so both surfaces feel coherent. Works on both
   <a> and <button> so links rendered next to form-submit buttons
   (e.g. detail-page "Edit / Delete" row) look like siblings.

   - `.btn`           — baseline (padding, border, hover, accessible focus ring)
   - `.btn-primary`   — accent fill, white text (primary CTA)
   - `.btn-secondary` — surface fill, accent border (secondary action)
   - `.btn-danger`    — red border/text, red fill on hover (destructive)
   - `.btn-link`      — text-style, no border (subtle nav)
   - `.btn-row-action`— pill-shaped accent-tinted (per-row table actions)

   Bare `<button>` inherits the baseline via the default selector
   below; templates that want a colored variant add `.btn` plus a
   modifier class.
   ------------------------------------------------------------------ */

/* Button + button-like-anchor baseline. `.btn, button` as a
   selector list — each selector takes its own specificity
   (`button` = 0,0,1; `.btn` = 0,1,0). The variant classes below
   are also 0,1,0 and declared later, so they win by source order
   for any property they re-declare. No `:not()` negations needed
   (and the previous `button:not(.theme-toggle)` shape was the bug
   that out-specified `.btn-secondary`). `.theme-toggle` (0,1,0)
   declared later in the file overrides this for the theme switcher. */
.btn, button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: inherit;
  padding: 0.4rem var(--space-4);
  cursor: pointer;
  background: var(--color-bg-surface);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover, button:hover { background: var(--color-bg-hover); }
.btn:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Variants — same specificity as `.btn` (0,1,0), declared later so
   source order wins. Each variant overrides the surface color +
   border-color + text color. */
.btn-primary {
  background: var(--color-accent);
  color: var(--color-fg-on-accent, #fff);
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: var(--color-fg-on-accent, #fff);
}
.btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-secondary:hover {
  background: var(--color-accent-bg-soft);
  color: var(--color-accent);
}
.btn-danger {
  background: transparent;
  color: var(--color-error-fg, #b04141);
  border-color: var(--color-error-fg, #b04141);
}
.btn-danger:hover {
  background: var(--color-error-fg, #b04141);
  color: #fff;
}
.btn-link {
  background: transparent;
  border: 0;
  padding: 0.4rem 0;
  /* Use accent for high contrast in both themes. Previously used
     `--color-link` which is too muted on the warm beige sidebar
     surface, and `--color-fg-muted` (op console's prior shape) was
     even worse. Accent is the same color the rest of the chrome
     uses for active links. */
  color: var(--color-accent);
  text-decoration: none;
  font-weight: var(--font-weight-medium, 500);
}
.btn-link:hover { color: var(--color-accent-hover); text-decoration: underline; }
.btn-row-action {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--color-accent-bg-soft);
  color: var(--color-accent);
  font-size: 0.85em;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.4;
}
.btn-row-action:hover {
  background: var(--color-accent);
  color: var(--color-fg-on-accent, #fff);
  text-decoration: none;
}

/* Container for a row of action buttons (detail page, form submit
   row, sidebar Logout). Flex-row, consistent gap, wraps on small
   screens. */
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
  margin: var(--space-3) 0;
}

/* Django-shape `help_text` caption rendered under each form input
   when `#[rustango(help_text = "...")]` is set on the field. */
.help-text {
  margin: var(--space-1) 0 0;
  color: var(--color-fg-muted);
  font-size: 0.85em;
  line-height: 1.4;
  max-width: 42em;
}
dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); }
dt { font-weight: var(--font-weight-bold); }
.audit-cleanup {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-3) 0;
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.9em;
}
.audit-cleanup label { display: inline-flex; gap: 0.35rem; align-items: center; }
.audit-cleanup small.muted { font-size: 0.85em; }
.user-roles-panel { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.user-roles-panel h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-fg-subtle);
  margin-bottom: var(--space-2);
}
.user-roles-panel h3 {
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-fg-subtle);
  margin: 0 0 var(--space-2) 0;
}
.user-roles-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
.user-roles-list, .user-perms-list { padding-left: 0; list-style: none; margin: 0; }
.user-roles-list li, .user-perms-list li {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  margin-bottom: var(--space-1);
  font-size: 0.9em;
}
.user-perms-list code { font-family: var(--font-family-mono); font-size: 0.95em; }
.user-roles-help { margin-top: var(--space-3); color: var(--color-fg-subtle); }
.audit-trail { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--color-border); }
.audit-trail h2 {
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-fg-subtle);
  margin-bottom: var(--space-2);
}
.audit-trail ol { padding-left: 0; list-style: none; }
.audit-trail li {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}
.audit-op {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: var(--font-weight-bold);
}
.audit-op-create { background: var(--color-audit-create-bg); color: var(--color-audit-create-fg); }
.audit-op-update { background: var(--color-audit-update-bg); color: var(--color-audit-update-fg); }
.audit-op-delete { background: var(--color-audit-delete-bg); color: var(--color-audit-delete-fg); }
.audit-op-soft_delete { background: var(--color-audit-delete-bg); color: var(--color-audit-delete-fg); }
.audit-op-restore { background: var(--color-audit-restore-bg); color: var(--color-audit-restore-fg); }
.audit-op-action { background: var(--color-audit-action-bg); color: var(--color-audit-action-fg); }
.audit-changes {
  font-family: var(--font-family-mono);
  font-size: 0.8em;
  background: var(--color-bg-code);
  padding: 0.35rem var(--space-2);
  border-radius: var(--radius-sm);
  margin: 0.35rem 0 0 0;
  white-space: pre-wrap;
  word-break: break-all;
}
.form-fieldset {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin: 0 0 var(--space-4) 0;
  padding: var(--space-2) var(--space-4) var(--space-4);
  background: var(--color-bg-surface);
}
.form-fieldset legend {
  padding: 0 var(--space-2);
  font-weight: var(--font-weight-bold);
  color: var(--color-fg-muted);
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-fieldset > table { background: transparent; }
.form-fieldset > table th,
.form-fieldset > table td {
  border: none;
  border-bottom: 1px solid var(--color-border);
  padding: 0.35rem 0.4rem;
}
.list-form { margin: 0; }
.action-bar {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  padding: 0.35rem var(--space-2);
  background: var(--color-bg-sidebar);
  border: 1px solid var(--color-border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 0.9em;
}
.action-bar select { padding: var(--space-1) 0.35rem; font: inherit; }
.checkbox-col { width: 28px; text-align: center; padding: 0.15rem var(--space-1) !important; }
.list-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: var(--space-5);
  align-items: start;
}
.list-shell.no-rail { grid-template-columns: 1fr; }
.list-rail { font-size: 0.9em; }
.list-rail .facet {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}
.list-rail .facet h4 {
  margin: 0 0 0.35rem 0;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-fg-subtle);
  font-weight: var(--font-weight-bold);
}
.list-rail .facet ul { list-style: none; padding: 0; margin: 0; }
.list-rail .facet li { margin: 0.15rem 0; line-height: 1.4; }
.list-rail .facet a { color: var(--color-fg); }
.list-rail .facet a.active { color: var(--color-accent); font-weight: var(--font-weight-bold); }
.list-rail .facet .count { color: var(--color-fg-subtle); font-size: 0.85em; }
.list-rail .facet .facet-more a { color: var(--color-fg-subtle); font-style: italic; }
.list-rail .facet .facet-more a:hover { color: var(--color-accent); }
.theme-toggle {
  position: fixed;
  bottom: var(--space-4);
  right: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg-surface);
  color: var(--color-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font: inherit;
  font-size: var(--font-size-sm);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  z-index: 100;
}
.theme-toggle:hover { border-color: var(--color-accent); color: var(--color-accent); }
/* v0.27.8 (#78) — operator impersonation banner. Bright,
   high-contrast, sticky at the top so it can't be missed
   while scrolling the admin. */
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.6rem 1rem;
  background: var(--color-warning-bg, #fff4cc);
  color: var(--color-warning-fg, #6b4500);
  border-bottom: 2px solid var(--color-warning-fg, #6b4500);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.impersonation-banner code {
  background: rgba(0, 0, 0, 0.08);
  padding: 0.05em 0.35em;
  border-radius: 0.2em;
  font-size: 12px;
}
.impersonation-banner .btn-end-impersonation {
  margin-left: auto;
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm, 4px);
  background: var(--color-warning-fg, #6b4500);
  color: var(--color-bg-surface, #fff);
  border: 0;
  font: inherit;
  font-weight: var(--font-weight-bold, 600);
  cursor: pointer;
}
.impersonation-banner .btn-end-impersonation:hover {
  filter: brightness(1.15);
}
.theme-toggle:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* Boolean column rendering — replaces literal "true"/"false" text
   with a checkbox glyph. Filled ☑ in the accent color when true,
   empty ☐ in muted color otherwise. Lets eyes scan tens of rows
   in a single sweep. */
.rcms-bool { font-size: 1.2em; line-height: 1; }
.rcms-bool.yes { color: var(--color-accent); }
.rcms-bool.no { color: var(--color-text-muted); }
@media (max-width: 1000px) {
  .list-shell { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  aside.sidebar { border-right: none; border-bottom: 1px solid var(--color-border); }
  main.content { padding: var(--space-4); }
}
</style>