Skip to content

Commit

Permalink
Remove provider change form template overrides
Browse files Browse the repository at this point in the history
We relied on these before, to make tags and
autocomplete work, but we no longer need them
  • Loading branch information
mrchrisadams committed Sep 21, 2023
1 parent 684178f commit d30b54b
Showing 1 changed file with 56 additions and 98 deletions.
154 changes: 56 additions & 98 deletions templates/admin/accounts/hostingprovider/change_form.html
Original file line number Diff line number Diff line change
@@ -1,111 +1,69 @@
{% extends "admin/change_form.html" %}

{% block extrahead %}
<script src="{% url 'admin:jsi18n' %}"></script>
{{ media }}

{% comment %}

This introduces hard coding of the media elements in as a last ditch attempt to get past the infuriating "no tags when debug off" issue, on the hosting provider page.
below is the same output as is generated by outputing:

{% block.super %}

... but we are serving unminified versions of all the files.

{% endcomment %}

<link href="/static/taggit_labels/css/taggit_labels.css" type="text/css" media="all" rel="stylesheet">
<link href="/static/admin/css/vendor/select2/select2.css" type="text/css" media="screen" rel="stylesheet">
<link href="/static/admin/css/autocomplete.css" type="text/css" media="screen" rel="stylesheet">
<link href="/static/autocomplete_light/select2.css" type="text/css" media="screen" rel="stylesheet">
<script src="/static/admin/js/vendor/jquery/jquery.js"></script>
<script src="/static/admin/js/vendor/select2/select2.full.js"></script>
<script src="/static/admin/js/calendar.js"></script>
<script src="/static/admin/js/jquery.init.js"></script>
<script src="/static/autocomplete_light/autocomplete_light.js"></script>
<script src="/static/admin/js/admin/DateTimeShortcuts.js"></script>
<script src="/static/admin/js/core.js"></script>
<script src="/static/autocomplete_light/select2.js"></script>
<script src="/static/admin/js/inlines.js"></script>
<script src="/static/greencheck/js/email.js"></script>
<script src="/static/admin/js/admin/RelatedObjectLookups.js"></script>
<script src="/static/taggit_labels/js/taggit_labels.js"></script>
<script src="/static/autocomplete_light/i18n/en.js"></script>
<script src="/static/admin/js/actions.js"></script>
<script src="/static/admin/js/urlify.js"></script>
<script src="/static/admin/js/prepopulate.js"></script>
<script src="/static/admin/js/vendor/xregexp/xregexp.js"></script>

{% endblock %}


{% block field_sets %}
{% for fieldset in adminform %}
{% if fieldset.name == "Hostingprovider info" %}
{% include "admin/accounts/hostingprovider/hosting_provider_fieldset.html" %}
{% elif fieldset.name == "Datacenter info" %}
{% include "admin/accounts/hostingprovider/data_center_fieldset.html" %}
{% else %}
{% include "admin/includes/fieldset.html" %}
{% endif %}
{% endfor %}
{% for fieldset in adminform %}
{% if fieldset.name == "Hostingprovider info" %}
{% include "admin/accounts/hostingprovider/hosting_provider_fieldset.html" %}
{% elif fieldset.name == "Datacenter info" %}
{% include "admin/accounts/hostingprovider/data_center_fieldset.html" %}
{% else %}
{% include "admin/includes/fieldset.html" %}
{% endif %}
{% endfor %}
{% endblock %}

{% block inline_field_sets %}
{% for inline_admin_formset in inline_admin_formsets %}
{% comment %}
{% for inline_admin_formset in inline_admin_formsets %}
{% comment %}
We only want to serve the special inline tabular version
of the IP approvals widgets and for IP range widgets,
as some providers have massive numbers that stop the page loading
as some providers have massive numbers that stop the page loading
properly.
The rest we want to serve as using their default inlines.
{% endcomment %}

{% if inline_admin_formset.opts.verbose_name_plural == "IP approvals" %}

{% if ip_approval_count > 500 %}
<fieldset class="module {{ inline_admin_formset.classes }}">
<h2>
{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}
</h2>
<p>
There are {{ ip_approval_count }} ip approval requests associated with this provider, which is too many to show on this page. Follow this
<a href="{{ bulk_edit_ip_approval_link }}">
this link to the bulk editing interface, with this provider pre-selected.
</a>
</p>
</fieldset>
{% else %}
{% include "admin/accounts/hostingprovider/inline_tabular.html" %}
{% endif %}

{% elif inline_admin_formset.opts.verbose_name_plural == "IPs" %}

{% if ip_range_count > 500 %}
<fieldset class="module {{ inline_admin_formset.classes }}">
<h2>
{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}
</h2>

<p>
There are {{ ip_range_count }} ip ranges associated with this provider, which is too many to show on this page. Follow this
<a href="{{ bulk_edit_ip_range_link }}">
this link to the bulk editing interface, with this provider pre-selected.
</a>
</p>
</fieldset>
{% else %}
<h2>
{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}
</h2>
{% include "admin/accounts/hostingprovider/inline_tabular.html" %}
{% endif %}

{% else %}
{% include inline_admin_formset.opts.template %}
{% endif %}
{% endfor %}
{% if inline_admin_formset.opts.verbose_name_plural == "IP approvals" %}

{% if ip_approval_count > 500 %}
<fieldset class="module {{ inline_admin_formset.classes }}">
<h2>
{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}
</h2>
<p>
There are {{ ip_approval_count }} ip approval requests associated with this provider, which is too many to show on this page. Follow this
<a href="{{ bulk_edit_ip_approval_link }}">
this link to the bulk editing interface, with this provider pre-selected.
</a>
</p>
</fieldset>
{% else %}
{% include "admin/accounts/hostingprovider/inline_tabular.html" %}
{% endif %}

{% elif inline_admin_formset.opts.verbose_name_plural == "IPs" %}

{% if ip_range_count > 500 %}
<fieldset class="module {{ inline_admin_formset.classes }}">
<h2>
{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}
</h2>

<p>
There are {{ ip_range_count }} ip ranges associated with this provider, which is too many to show on this page. Follow this
<a href="{{ bulk_edit_ip_range_link }}">
this link to the bulk editing interface, with this provider pre-selected.
</a>
</p>
</fieldset>
{% else %}
<h2>
{{ inline_admin_formset.opts.verbose_name_plural|capfirst }}
</h2>
{% include "admin/accounts/hostingprovider/inline_tabular.html" %}
{% endif %}

{% else %}
{% include inline_admin_formset.opts.template %}
{% endif %}
{% endfor %}
{% endblock %}


0 comments on commit d30b54b

Please sign in to comment.