Merge pull request #867 from cisagov/rjm/839-django-admin-staff-column-missing

839 - Fix missing column in django admin for Staff users
This commit is contained in:
rachidatecs 2023-08-14 10:56:17 -04:00 committed by GitHub
commit 798f021e98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,8 +17,9 @@ Load our custom filters to extract info from the django generated markup.
<thead> <thead>
<tr> <tr>
{# .gov - hardcode the select all checkbox #} {% if results.0.form %}
<th scope="col" class="action-checkbox-column" title="Toggle all"> {# .gov - hardcode the select all checkbox #}
<th scope="col" class="action-checkbox-column" title="Toggle all">
<div class="text"> <div class="text">
<span> <span>
<input type="checkbox" name="_selected_action" id="action-toggle"> <input type="checkbox" name="_selected_action" id="action-toggle">
@ -26,11 +27,10 @@ Load our custom filters to extract info from the django generated markup.
</span> </span>
</div> </div>
<div class="clear"></div> <div class="clear"></div>
</th> </th>
{# .gov - don't let django generate the select all checkbox #} {# .gov - don't let django generate the select all checkbox #}
{% for header in result_headers|slice:"1:" %} {% for header in result_headers|slice:"1:" %}
<th scope="col"{{ header.class_attrib }}>
<th scope="col"{{ header.class_attrib }}>
{% if header.sortable %} {% if header.sortable %}
{% if header.sort_priority > 0 %} {% if header.sort_priority > 0 %}
<div class="sortoptions"> <div class="sortoptions">
@ -42,28 +42,20 @@ Load our custom filters to extract info from the django generated markup.
{% endif %} {% endif %}
<div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %}</div> <div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %}</div>
<div class="clear"></div> <div class="clear"></div>
</th>{% endfor %} </th>{% endfor %}
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% comment %} {% comment %}
{% for result in results %} .gov - hardcode the row checkboxes using the custom filters to extract
{% if result.form.non_field_errors %} the value attribute's value, and a label based on the anchor elements's
<tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr> text. Then edit the for loop to keep django from generating the row select
{% endif %} checkboxes.
<tr>{% for item in result %}{{ item }}{% endfor %}</tr> {% endcomment %}
{% endfor %}
{% endcomment %}
{% comment %} {% for result in results %}
.gov - hardcode the row checkboxes using the custom filters to extract
the value attribute's value, and a label based on the anchor elements's
text. Then edit the for loop to keep django from generating the row select
checkboxes.
{% endcomment %}
{% for result in results %}
{% if result.form.non_field_errors %} {% if result.form.non_field_errors %}
<tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr> <tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr>
{% endif %} {% endif %}
@ -82,7 +74,37 @@ checkboxes.
{{ item }} {{ item }}
{% endfor %} {% endfor %}
</tr> </tr>
{% endfor %} {% endfor %}
{% else %} {# results doesn't have a form as its first element #}
{% for header in result_headers %}
<th scope="col"{{ header.class_attrib }}>
{% if header.sortable %}
{% if header.sort_priority > 0 %}
<div class="sortoptions">
<a class="sortremove" href="{{ header.url_remove }}" title="{% translate "Remove from sorting" %}"></a>
{% if num_sorted_fields > 1 %}<span class="sortpriority" title="{% blocktranslate with priority_number=header.sort_priority %}Sorting priority: {{ priority_number }}{% endblocktranslate %}">{{ header.sort_priority }}</span>{% endif %}
<a href="{{ header.url_toggle }}" class="toggle {% if header.ascending %}ascending{% else %}descending{% endif %}" title="{% translate "Toggle sorting" %}"></a>
</div>
{% endif %}
{% endif %}
<div class="text">{% if header.sortable %}<a href="{{ header.url_primary }}">{{ header.text|capfirst }}</a>{% else %}<span>{{ header.text|capfirst }}</span>{% endif %}</div>
<div class="clear"></div>
</th>{% endfor %}
</tr>
</thead>
<tbody>
{% for result in results %}
{% if result.form.non_field_errors %}
<tr><td colspan="{{ result|length }}">{{ result.form.non_field_errors }}</td></tr>
{% endif %}
<tr>{% for item in result %}{{ item }}{% endfor %}</tr>
{% endfor %}
{% endif %}
</tbody> </tbody>
</table> </table>