Tag¶
User-defined label, optionally colored. Global today; per-tenant in Phase 5.
Fields¶
| Field | Type | Default | Notes |
|---|---|---|---|
id |
int | autoincrement | (taggit-managed) |
name |
char | unique | The visible label |
slug |
slug | unique | URL-safe |
color |
char(7) | "" |
Optional #xxxxxx |
Rendering¶
| Tag has | Renders as |
|---|---|
color = "" (colorless) |
Neutral zinc-100 chip |
color = "#10b981" etc |
Solid colored chip with computed black/white text |
Text color is computed from sRGB luminance:
@property
def text_color(self) -> str:
if not self.color:
return ""
h = self.color.lstrip("#")
r, g, b = int(h[0:2], 16), int(h[2:4], 16), int(h[4:6], 16)
luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255
return "#000" if luminance > 0.6 else "#fff"
Threshold of 0.6 biases slightly toward black text on light backgrounds (e.g. amber gets black text, emerald gets white).
TaggedItem¶
Custom core.TaggedItem(GenericUUIDTaggedItemBase) — needed because all our
content models have UUID PKs and taggit's default IntegerField object_id
would overflow.
Coming in Phase 5¶
tenantFK onTag(per-tenant scoping)- Tag CRUD UI (today: Django admin only)
- A consolidated tag picker on prefix / IP forms