#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:

> 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.

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 %}
     {% 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#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/062.7a05108cc40b292fef8115b0f324791e%40djangoproject.com.

Reply via email to