mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-30 06:26:34 +02:00
admin: add favicon, fix button height bug, remove link from table caption, add search helper text to logentry, remove submit buttons from logentry
This commit is contained in:
parent
74ea2e0be7
commit
7e918ff537
6 changed files with 61 additions and 6 deletions
|
@ -6,9 +6,20 @@ from django.http.response import HttpResponseRedirect
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from registrar.models.utility.admin_sort_fields import AdminSortFields
|
from registrar.models.utility.admin_sort_fields import AdminSortFields
|
||||||
from . import models
|
from . import models
|
||||||
|
from auditlog.models import LogEntry # type: ignore
|
||||||
|
from auditlog.admin import LogEntryAdmin # type: ignore
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
class CustomLogEntryAdmin(LogEntryAdmin):
|
||||||
|
# Overwrite the generated LogEntry admin class
|
||||||
|
|
||||||
|
search_help_text = "Search by resource, changed field, or user."
|
||||||
|
|
||||||
|
change_form_template = 'admin/change_form_no_submit.html'
|
||||||
|
add_form_template = 'admin/change_form_no_submit.html'
|
||||||
|
|
||||||
|
|
||||||
class AuditedAdmin(admin.ModelAdmin, AdminSortFields):
|
class AuditedAdmin(admin.ModelAdmin, AdminSortFields):
|
||||||
"""Custom admin to make auditing easier."""
|
"""Custom admin to make auditing easier."""
|
||||||
|
@ -400,6 +411,8 @@ class DomainApplicationAdmin(ListHeaderAdmin):
|
||||||
return super().change_view(request, object_id, form_url, extra_context)
|
return super().change_view(request, object_id, form_url, extra_context)
|
||||||
|
|
||||||
|
|
||||||
|
admin.site.unregister(LogEntry) # Unregister the default registration
|
||||||
|
admin.site.register(LogEntry, CustomLogEntryAdmin)
|
||||||
admin.site.register(models.User, MyUserAdmin)
|
admin.site.register(models.User, MyUserAdmin)
|
||||||
admin.site.register(models.UserDomainRole, AuditedAdmin)
|
admin.site.register(models.UserDomainRole, AuditedAdmin)
|
||||||
admin.site.register(models.Contact, ContactAdmin)
|
admin.site.register(models.Contact, ContactAdmin)
|
||||||
|
|
|
@ -140,7 +140,7 @@ h1, h2, h3 {
|
||||||
font-weight: font-weight('bold');
|
font-weight: font-weight('bold');
|
||||||
}
|
}
|
||||||
|
|
||||||
table > caption > a {
|
table > caption > span {
|
||||||
font-weight: font-weight('bold');
|
font-weight: font-weight('bold');
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
|
@ -158,8 +158,10 @@ table > caption > a {
|
||||||
padding-top: 20px;
|
padding-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'Delete button' layout bug
|
// Fix django admin button height bugs
|
||||||
.submit-row a.deletelink {
|
.submit-row a.deletelink,
|
||||||
|
.delete-confirmation form .cancel-link,
|
||||||
|
.submit-row a.closelink {
|
||||||
height: auto!important;
|
height: auto!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,11 +4,13 @@
|
||||||
{% for app in app_list %}
|
{% for app in app_list %}
|
||||||
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path|urlencode %} current-app{% endif %}">
|
<div class="app-{{ app.app_label }} module{% if app.app_url in request.path|urlencode %} current-app{% endif %}">
|
||||||
<table>
|
<table>
|
||||||
|
{# .gov override: remove link #}
|
||||||
<caption>
|
<caption>
|
||||||
<a href="{{ app.app_url }}" class="section" title="{% blocktranslate with name=app.name %}Models in the {{ name }} application{% endblocktranslate %}">{{ app.name }}</a>
|
<span class="section">{{ app.name }}</span>
|
||||||
</caption>
|
</caption>
|
||||||
|
{# end .gov override #}
|
||||||
|
|
||||||
{# .gov override #}
|
{# .gov override: add headers #}
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Model</th>
|
<th scope="col">Model</th>
|
||||||
|
|
|
@ -2,6 +2,24 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
|
{% block extrahead %}
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32"
|
||||||
|
href="{% static 'img/registrar/favicons/favicon-32.png' %}"
|
||||||
|
>
|
||||||
|
<link rel="icon" type="image/png" sizes="192x192"
|
||||||
|
href="{% static 'img/registrar/favicons/favicon-192.png' %}"
|
||||||
|
>
|
||||||
|
<link rel="icon" type="image/svg+xml"
|
||||||
|
href="{% static 'img/registrar/favicons/favicon.svg' %}"
|
||||||
|
>
|
||||||
|
<link rel="shortcut icon" type="image/x-icon"
|
||||||
|
href="{% static 'img/registrar/favicons/favicon.ico' %}"
|
||||||
|
>
|
||||||
|
<link rel="apple-touch-icon" size="180x180"
|
||||||
|
href="{% static 'img/registrar/favicons/favicon-180.png' %}"
|
||||||
|
>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
|
{% block title %}{% if subtitle %}{{ subtitle }} | {% endif %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
|
||||||
|
|
||||||
{% block extrastyle %}{{ block.super }}
|
{% block extrastyle %}{{ block.super }}
|
||||||
|
|
|
@ -9,4 +9,4 @@
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
20
src/registrar/templates/admin/change_form_no_submit.html
Normal file
20
src/registrar/templates/admin/change_form_no_submit.html
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{% extends "admin/change_form.html" %}
|
||||||
|
|
||||||
|
{% comment %} Replace the Django ul markup with a div. We'll edit the child markup accordingly in change_form_object_tools {% endcomment %}
|
||||||
|
{% block object-tools %}
|
||||||
|
{% if change and not is_popup %}
|
||||||
|
<div class="object-tools">
|
||||||
|
{% block object-tools-items %}
|
||||||
|
{{ block.super }}
|
||||||
|
{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block submit_buttons_top %}
|
||||||
|
{# Do not render the submit buttons #}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block submit_buttons_bottom %}
|
||||||
|
{# Do not render the submit buttons #}
|
||||||
|
{% endblock %}
|
Loading…
Add table
Add a link
Reference in a new issue