Modify some admin
This commit is contained in:
parent
1f86b3fc07
commit
b6e450260b
3 changed files with 8 additions and 5 deletions
|
@ -212,10 +212,8 @@ else:
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
("judge.BlogPost", "fa-rss-square"),
|
("judge.BlogPost", "fa-rss-square"),
|
||||||
("judge.Comment", "fa-comment-o"),
|
|
||||||
("judge.Ticket", "fa-exclamation-circle"),
|
("judge.Ticket", "fa-exclamation-circle"),
|
||||||
("flatpages.FlatPage", "fa-file-text-o"),
|
("admin.LogEntry", "fa-empire"),
|
||||||
("judge.Solution", "fa-pencil"),
|
|
||||||
],
|
],
|
||||||
"dashboard": {
|
"dashboard": {
|
||||||
"breadcrumbs": True,
|
"breadcrumbs": True,
|
||||||
|
|
|
@ -176,7 +176,7 @@ class LogEntryAdmin(admin.ModelAdmin):
|
||||||
"object_link",
|
"object_link",
|
||||||
"diff_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_filter = (UserListFilter, "content_type")
|
||||||
list_display_links = None
|
list_display_links = None
|
||||||
actions = None
|
actions = None
|
||||||
|
|
|
@ -10,6 +10,7 @@ from django.urls import reverse_lazy
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.translation import gettext, gettext_lazy as _, ungettext
|
from django.utils.translation import gettext, gettext_lazy as _, ungettext
|
||||||
from django_ace import AceWidget
|
from django_ace import AceWidget
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
from reversion.admin import VersionAdmin
|
from reversion.admin import VersionAdmin
|
||||||
from reversion_compare.admin import CompareVersionAdmin
|
from reversion_compare.admin import CompareVersionAdmin
|
||||||
|
@ -58,6 +59,9 @@ class ProblemForm(ModelForm):
|
||||||
memory_unit = self.cleaned_data.get("memory_unit", "KB")
|
memory_unit = self.cleaned_data.get("memory_unit", "KB")
|
||||||
if memory_unit == "MB":
|
if memory_unit == "MB":
|
||||||
self.cleaned_data["memory_limit"] *= 1024
|
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
|
return self.cleaned_data
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -237,11 +241,12 @@ class ProblemAdmin(CompareVersionAdmin):
|
||||||
"code",
|
"code",
|
||||||
"name",
|
"name",
|
||||||
"show_authors",
|
"show_authors",
|
||||||
|
"date",
|
||||||
"points",
|
"points",
|
||||||
"is_public",
|
"is_public",
|
||||||
"show_public",
|
"show_public",
|
||||||
]
|
]
|
||||||
ordering = ["code"]
|
ordering = ["-date"]
|
||||||
search_fields = (
|
search_fields = (
|
||||||
"code",
|
"code",
|
||||||
"name",
|
"name",
|
||||||
|
|
Loading…
Reference in a new issue