sehmaschine / django-grappelli

A jazzy skin for the Django Admin-Interface (official repository).
http://www.grappelliproject.com
Other
3.77k stars 657 forks source link

Grappelli doesn't allow to extend some templates #1044

Closed Alain1405 closed 10 months ago

Alain1405 commented 10 months ago

I am trying to add an additional Save button to the admin. This can be done by extending the submit_line.html template (which is available both in Django and Grappelli templates) as documented here and here. To be clear, I have added a template named templates/admin/app_name/model_name/submit_line.html to my project.

If I disable Grappelli the template works just fine and I see the new button. With Grappelli enabled the new template has no effect. I tried to change the order of apps without succes.

Template:

{% extends 'admin/submit_line.html' %}
{% load i18n admin_urls %}

{% block submit-row %}
    {{ block.super }}
    <NewButton>
{% endblock %}

UPDATE: I should clarify that if I change the whole Change form template by setting change_form_template variable, then I can extend the whole form, but this is not what I want to do

parsch commented 10 months ago

The Grappelli submit line is not really extendable yet (it doesn't contain a block), I will take a look at that (needs different DOM and styles).

parsch commented 10 months ago

@Alain1405 I added a new submit line to stable/3.0.x and stable/4.0.x branches. Could you please check if that fits your purpose?

Alain1405 commented 10 months ago

Hi @parsch , thanks for the quick response! It looks like it works (I can extend submit_line) but the layout is now broken whether I extend the template or not.

Screenshot 2024-01-17 at 15 30 04

UPDATE: I take it back, it works after refreshing the cache! Thanks for adding this, I will test a little more but looks like it's working. I checked stable/3.0.x

parsch commented 10 months ago

@Alain1405 thanks for checking!