Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grappelli doesn't allow to extend some templates #1044

Closed
Alain1405 opened this issue Jan 3, 2024 · 4 comments
Closed

Grappelli doesn't allow to extend some templates #1044

Alain1405 opened this issue Jan 3, 2024 · 4 comments
Assignees

Comments

@Alain1405
Copy link

Alain1405 commented Jan 3, 2024

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 parsch self-assigned this Jan 13, 2024
@parsch
Copy link
Collaborator

parsch commented Jan 13, 2024

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
Copy link
Collaborator

parsch commented Jan 16, 2024

@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
Copy link
Author

Alain1405 commented Jan 17, 2024

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
Copy link
Collaborator

parsch commented Jan 17, 2024

@Alain1405 thanks for checking!

@parsch parsch closed this as completed Jan 17, 2024
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

No branches or pull requests

2 participants