Skip to content

Fix dashblock teaser and str with NULL fields, whole-tag filtering and image upload path - #262

Open
norkans7 wants to merge 3 commits into
mainfrom
dashblock-model-fixes
Open

Fix dashblock teaser and str with NULL fields, whole-tag filtering and image upload path#262
norkans7 wants to merge 3 commits into
mainfrom
dashblock-model-fixes

Conversation

@norkans7

Copy link
Copy Markdown
Contributor

Several dashblock fixes: teaser methods crashed with AttributeError when the underlying field was NULL (legitimately the case when the block type disables it) and appended a truncation suffix even when nothing was truncated; __str__ returned None for a titled type with a NULL title; the load_dashblocks template tag filtered tags with a bare substring match, contradicting the padded space-delimited storage format (loading "art" also matched "smart"); and the image upload path had a trailing slash producing double-slash paths.

Teasers now return an empty string for NULL fields and only append the suffix when truncating, __str__ falls back to the type name and pk, tag filtering matches whole padded tags, and the upload folder is normalized (with a migration for the upload_to change). All covered by tests.

norkans7 added 3 commits July 27, 2026 13:34
Tag normalization (lowercase, collapsed whitespace, space padding) now
happens in DashBlock.save() so blocks created outside the edit views
also match whole-tag filtering. A data migration normalizes existing
rows, and the load_dashblocks tag treats an empty or None tag as no
filtering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant