Skip to content

Improve template extensibility through more blocks #946

@lukeclimen

Description

@lukeclimen

Checklist

  • There are no similar issues or pull requests for this yet.

Is your feature related to a problem? Please describe.

I want to be able to overwrite parts of templates for my own needs, without completely replacing the library-provided template.

Currently, if I want to customize an existing template, I can do so by following the docs. If I do customize a template, however, I essentially have to completely replace it, as there is typically only one block - for content. This is a big problem, as I will no longer receive updates for this template from library version bumps, and my version of the template will eventually fall behind.

If I'd like to update the query that populates the template, and add an additional field that is inaccessible using the library's template, I cannot follow the suggested approach in the docs:

{% extends "sqladmin/details.html" %}
{% block content %}
    {{ super() }}
    <p>Custom HTML</p>
{% endblock %}

This would cause my additional field to render after the entire form, card and buttons to submit/save.

Describe the solution you would like.

I'd like to propose enhancing the existing templates with more blocks, which will allow users to extend the template, and only overwrite the section that they are interested in changing. If you are okay with this suggestion, I can get working on a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions