Fixed text search fileds for ACL and Logs. Added version info to footer.

This commit is contained in:
Ultradesu
2025-06-20 11:30:56 +01:00
parent bf4bc505de
commit 8e378cb787
6 changed files with 115 additions and 6 deletions

View File

@@ -125,7 +125,7 @@ class UserAdmin(admin.ModelAdmin):
class AccessLogAdmin(admin.ModelAdmin):
list_display = ('user', 'server', 'action', 'formatted_timestamp')
list_filter = ('user', 'server', 'action', 'timestamp')
search_fields = ('user', 'server', 'action', 'timestamp')
search_fields = ('user', 'server', 'action', 'timestamp', 'data')
readonly_fields = ('server', 'user', 'formatted_timestamp', 'action', 'formated_data')
@admin.display(description='Timestamp')
@@ -161,7 +161,8 @@ class ACLAdmin(admin.ModelAdmin):
list_display = ('user', 'server', 'server_type', 'display_links', 'created_at')
list_filter = (UserNameFilter, 'server__server_type', ServerNameFilter)
search_fields = ('user__name', 'server__name', 'server__comment', 'user__comment', 'links__link')
# Fixed search_fields - removed problematic polymorphic server fields
search_fields = ('user__username', 'user__comment', 'links__link')
readonly_fields = ('user_info',)
inlines = [ACLLinkInline]
@@ -184,4 +185,3 @@ class ACLAdmin(admin.ModelAdmin):
links = obj.links.all()
formatted_links = [f"{link.comment} - {EXTERNAL_ADDRESS}/ss/{link.link}#{link.acl.server.name}" for link in links]
return mark_safe('<br>'.join(formatted_links))

View File

@@ -0,0 +1,37 @@
{% extends "admin/base.html" %}
{% block title %}{{ title }} | {{ site_title|default:_('Django site admin') }}{% endblock %}
{% block branding %}
<h1 id="site-name"><a href="{% url 'admin:index' %}">{{ site_header|default:_('Django administration') }}</a></h1>
{% endblock %}
{% block footer %}
<div id="footer" style="margin-top: 20px; padding: 10px; border-top: 1px solid #ccc; font-size: 12px; color: #666;">
<div style="display: flex; justify-content: space-between; align-items: center;">
<div>
<strong>OutFleet VPN Manager</strong>
</div>
<div style="text-align: right;">
{% if VERSION_INFO %}
<div>
<strong>Version:</strong>
<code>{{ VERSION_INFO.git_commit_short }}</code>
{% if VERSION_INFO.is_development %}
<span style="color: #e74c3c;">(Development)</span>
{% endif %}
</div>
{% if not VERSION_INFO.is_development %}
<div style="margin-top: 2px;">
<strong>Built:</strong> {{ VERSION_INFO.build_date }}
</div>
<div style="margin-top: 2px;">
<strong>Commit:</strong>
<code style="font-size: 10px;">{{ VERSION_INFO.git_commit }}</code>
</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endblock %}