[Django] #33337: Part of admin template is ignored when deploying

7 views
Skip to first unread message

Django

unread,
Dec 2, 2021, 11:49:30 AM12/2/21
to django-...@googlegroups.com
#33337: Part of admin template is ignored when deploying
-------------------------------------------+------------------------
Reporter: xtlc | Owner: nobody
Type: Bug | Status: new
Component: Template system | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
I already opened an unanswered post on
[https://stackoverflow.com/questions/69928094/admin-template-is-ignored-
when-deploying Stackoverflow], which is the reason why I come here:

I changed the `change_form.html` and the `submit_line.html` template
within one of my projects. The `change_form.html` now reads:

{{{

{% extends "admin/change_form.html" %}
{% load i18n admin_urls %}


{% block after_field_sets %}
<h3>Preview (reload page for actual preview):</h3><br />
{{ img }}
{% endblock %}

{% block inline_field_sets %}
{% for inline_admin_formset in inline_admin_formsets %}
{% include inline_admin_formset.opts.template %}
{% endfor %}
warning!
{% endblock %}
}}}

and the `submit_line.html`:

{{{
{% load i18n admin_urls %}
<div class="submit-row">
{% if show_save %}<input type="submit" value="{% trans 'Save' %}"
class="default" name="_save" />{% endif %}
{% if show_delete_link %}
{% url opts|admin_urlname:'delete' original.pk|admin_urlquote as
delete_url %}
<p class="deletelink-box"><a href="{% add_preserved_filters
delete_url %}" class="deletelink">{% trans "Delete" %}</a></p>
{% endif %}
{% if show_download_zip %}
<input type="submit" value="zip" name="_download_zip" />
{% endif %}
{% if show_save_as_new %}
<input type="submit" value="{% trans 'Save as new' %}"
name="_saveasnew" />
{% endif %}
{% if show_save_and_add_another %}
<input type="submit" value="{% trans 'Save and add another' %}"
name="_addanother" />
{% endif %}
{% if show_save_and_continue %}
<input type="submit" value="{% trans 'Save and continue editing'
%}" name="_continue" />
{% endif %}
</div>
}}}

In my corresponding admin class I added:

{{{
def render_change_form(self, request, context, *args, **kwargs):
if not context["original"] == None:
context.update({'show_download_CSV': True})
return super().render_change_form(request, context, *args,
**kwargs)
}}}

and now for the part that is bugging me. When `DEBUG = True` is set, the
result looks like this:

[[Image(https://i.stack.imgur.com/YIOBJ.png)]]

but when setting `DEBUG= False`:

[[Image(https://i.stack.imgur.com/U36Bp.png)]]

I can not see any errors what so ever. I do not know if this is a bug or
maybe just a silly mistake on my side, but any help on what could be
checked is appreciated. This was tested on 3.2.8.

--
Ticket URL: <https://code.djangoproject.com/ticket/33337>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 2, 2021, 12:51:11 PM12/2/21
to django-...@googlegroups.com
#33337: Part of admin template is ignored when deploying
---------------------------------+--------------------------------------
Reporter: xtlc | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

Please don't use Trac as a support channel. Closing per
TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/33337#comment:1>

Django

unread,
Dec 2, 2021, 1:24:32 PM12/2/21
to django-...@googlegroups.com
#33337: Part of admin template is ignored when deploying
---------------------------------+--------------------------------------
Reporter: xtlc | Owner: nobody
Type: Bug | Status: closed

Component: Template system | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by xtlc:

Old description:

New description:

I already opened an unanswered post on
[https://stackoverflow.com/questions/69928094/admin-template-is-ignored-
when-deploying Stackoverflow], which is the reason why I come here:

I changed the `change_form.html` and the `submit_line.html` template
within one of my projects. The `change_form.html` now reads:

{{{

{% extends "admin/change_form.html" %}
{% load i18n admin_urls %}

{% block inline_field_sets %}

and the `submit_line.html`:

[[Image(https://i.stack.imgur.com/YIOBJ.png)]]

[[Image(https://i.stack.imgur.com/U36Bp.png)]]

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33337#comment:2>

Reply all
Reply to author
Forward
0 new messages