Modify some admin

This commit is contained in:
cuom1999 2022-09-02 18:03:54 -05:00
parent 1f86b3fc07
commit b6e450260b
3 changed files with 8 additions and 5 deletions

View file

@ -212,10 +212,8 @@ else:
],
},
("judge.BlogPost", "fa-rss-square"),
("judge.Comment", "fa-comment-o"),
("judge.Ticket", "fa-exclamation-circle"),
("flatpages.FlatPage", "fa-file-text-o"),
("judge.Solution", "fa-pencil"),
("admin.LogEntry", "fa-empire"),
],
"dashboard": {
"breadcrumbs": True,

View file

@ -176,7 +176,7 @@ class LogEntryAdmin(admin.ModelAdmin):
"object_link",
"diff_link",
)
search_fields = ("object_repr", "change_message")
search_fields = ("object_repr", "change_message", "user__username", "content_type__model")
list_filter = (UserListFilter, "content_type")
list_display_links = None
actions = None

View file

@ -10,6 +10,7 @@ from django.urls import reverse_lazy
from django.utils.html import format_html
from django.utils.translation import gettext, gettext_lazy as _, ungettext
from django_ace import AceWidget
from django.utils import timezone
from reversion.admin import VersionAdmin
from reversion_compare.admin import CompareVersionAdmin
@ -58,6 +59,9 @@ class ProblemForm(ModelForm):
memory_unit = self.cleaned_data.get("memory_unit", "KB")
if memory_unit == "MB":
self.cleaned_data["memory_limit"] *= 1024
date = self.cleaned_data.get("date")
if not date or date > timezone.now():
self.cleaned_data["date"] = timezone.now()
return self.cleaned_data
class Meta:
@ -237,11 +241,12 @@ class ProblemAdmin(CompareVersionAdmin):
"code",
"name",
"show_authors",
"date",
"points",
"is_public",
"show_public",
]
ordering = ["code"]
ordering = ["-date"]
search_fields = (
"code",
"name",