Skip to content

extra blocks for templates allowing customization#952

Open
birddevelper wants to merge 7 commits intosmithyhq:mainfrom
birddevelper:custom-blocks-in-templates
Open

extra blocks for templates allowing customization#952
birddevelper wants to merge 7 commits intosmithyhq:mainfrom
birddevelper:custom-blocks-in-templates

Conversation

@birddevelper
Copy link
Copy Markdown
Contributor

@birddevelper birddevelper commented Aug 31, 2025

Currently, adding a component to any part of the templates requires copying all the inherited template markup into the child template.

This PR refactors the content block into smaller, modular blocks, similar to how Django admin templates are structured. This allows developers to seamlessly insert components into a page without duplicating the entire template.

For example, to add a new button next to the existing top buttons:

{% extends "sqladmin/list.html" %}
{% block object_tools_items %}
{{ super() }}
<div class="ms-3 d-inline-block">
    <a href="some-link.html" class="btn btn-success">
        Some new button
    </a>
</div>
{% endblock %}

Result:
image

This PR also splits the head block into two separate blocks, extrahead and extrastyle , similar to Django admin templates.

@birddevelper birddevelper changed the title docs: fix custom template path extra blocks for templates allowing customization Aug 31, 2025
Copy link
Copy Markdown
Collaborator

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great, can we just follow Flask-Admin to be aligned with other features?
https://flask-admin.readthedocs.io/en/v1.0.9/templates/#jinja2-flask-admin

@aminalaee aminalaee linked an issue Oct 3, 2025 that may be closed by this pull request
1 task
@mmzeynalli
Copy link
Copy Markdown
Member

@birddevelper update?

@birddevelper
Copy link
Copy Markdown
Contributor Author

@mmzeynalli Will be updated soon. ;)

@birddevelper birddevelper force-pushed the custom-blocks-in-templates branch from 2224788 to 09f0e84 Compare January 18, 2026 17:09
@mmzeynalli
Copy link
Copy Markdown
Member

LGTM. But, I think it would be better to write tests for these, to make sure it is indeed in correct part of the HTML.

mmzeynalli referenced this pull request in mmzeynalli/sqladmin-ng Mar 30, 2026
Added extra blocks for templates allowing customization
@smithyhq smithyhq deleted a comment from mmzeynalli Mar 30, 2026
@mmzeynalli
Copy link
Copy Markdown
Member

@birddevelper any updates with tests?

@mmzeynalli mmzeynalli added the waiting-for-tests Feature is ready, but tests are missing label Apr 4, 2026
@birddevelper
Copy link
Copy Markdown
Contributor Author

birddevelper commented Apr 4, 2026 via email

@mmzeynalli mmzeynalli added ready-to-merge Approved and ready to merge. Will be published with the next release. and removed waiting-for-tests Feature is ready, but tests are missing labels Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Approved and ready to merge. Will be published with the next release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve template extensibility through more blocks

3 participants