Browse Source

Reduce the number of SQL queries in the "Check Details" page.

pull/340/head
Pēteris Caune 5 years ago
parent
commit
fcf11d5b4f
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 3 additions and 2 deletions
  1. +1
    -0
      hc/front/views.py
  2. +2
    -2
      templates/front/details.html

+ 1
- 0
hc/front/views.py View File

@ -521,6 +521,7 @@ def details(request, code):
"project": check.project,
"check": check,
"channels": channels,
"enabled_channels": list(check.channel_set.all()),
"timezones": pytz.all_timezones,
"downtimes": check.downtimes(months=3),
"is_new": "new" in request.GET,


+ 2
- 2
templates/front/details.html View File

@ -193,10 +193,10 @@
<h2>Notification Methods</h2>
<table id="details-integrations" class="table">
{% for channel in channels %}
<tr data-url="{% url 'hc-switch-channel' check.code channel.code %}" {% if channel in check.channel_set.all %}class="on"{% endif %}>
<tr data-url="{% url 'hc-switch-channel' check.code channel.code %}" {% if channel in enabled_channels %}class="on"{% endif %}>
<th>
<span class="label">
{% if channel in check.channel_set.all %}ON{% else %}OFF{% endif %}
{% if channel in enabled_channels %}ON{% else %}OFF{% endif %}
</span>
</th>
<td>


Loading…
Cancel
Save