Fix admin bugs
This commit is contained in:
parent
bb891e5b49
commit
570c3071ee
5 changed files with 7 additions and 13 deletions
|
@ -77,7 +77,6 @@ from judge.views.register import ActivationView, RegistrationView
|
||||||
from judge.views.select2 import (
|
from judge.views.select2 import (
|
||||||
AssigneeSelect2View,
|
AssigneeSelect2View,
|
||||||
ChatUserSearchSelect2View,
|
ChatUserSearchSelect2View,
|
||||||
CommentSelect2View,
|
|
||||||
ContestSelect2View,
|
ContestSelect2View,
|
||||||
ContestUserSearchSelect2View,
|
ContestUserSearchSelect2View,
|
||||||
OrganizationSelect2View,
|
OrganizationSelect2View,
|
||||||
|
@ -1066,9 +1065,6 @@ urlpatterns = [
|
||||||
url(
|
url(
|
||||||
r"^contest/$", ContestSelect2View.as_view(), name="contest_select2"
|
r"^contest/$", ContestSelect2View.as_view(), name="contest_select2"
|
||||||
),
|
),
|
||||||
url(
|
|
||||||
r"^comment/$", CommentSelect2View.as_view(), name="comment_select2"
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,7 +12,6 @@ class CommentForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
widgets = {
|
widgets = {
|
||||||
"author": AdminHeavySelect2Widget(data_view="profile_select2"),
|
"author": AdminHeavySelect2Widget(data_view="profile_select2"),
|
||||||
"parent": AdminHeavySelect2Widget(data_view="comment_select2"),
|
|
||||||
}
|
}
|
||||||
if HeavyPreviewAdminPageDownWidget is not None:
|
if HeavyPreviewAdminPageDownWidget is not None:
|
||||||
widgets["body"] = HeavyPreviewAdminPageDownWidget(
|
widgets["body"] = HeavyPreviewAdminPageDownWidget(
|
||||||
|
@ -39,7 +38,7 @@ class CommentAdmin(VersionAdmin):
|
||||||
)
|
)
|
||||||
list_display = ["author", "linked_object", "time"]
|
list_display = ["author", "linked_object", "time"]
|
||||||
search_fields = ["author__user__username", "body"]
|
search_fields = ["author__user__username", "body"]
|
||||||
readonly_fields = ["score"]
|
readonly_fields = ["score", "parent"]
|
||||||
actions = ["hide_comment", "unhide_comment"]
|
actions = ["hide_comment", "unhide_comment"]
|
||||||
list_filter = ["hidden"]
|
list_filter = ["hidden"]
|
||||||
actions_on_top = True
|
actions_on_top = True
|
||||||
|
|
|
@ -53,6 +53,7 @@ class NavigationBarAdmin(DraggableMPTTAdmin):
|
||||||
class BlogPostForm(ModelForm):
|
class BlogPostForm(ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(BlogPostForm, self).__init__(*args, **kwargs)
|
super(BlogPostForm, self).__init__(*args, **kwargs)
|
||||||
|
if "authors" in self.fields:
|
||||||
self.fields["authors"].widget.can_add_related = False
|
self.fields["authors"].widget.can_add_related = False
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -51,7 +51,10 @@ class ProblemDataStorage(FileSystemStorage):
|
||||||
|
|
||||||
def delete_directory(self, name):
|
def delete_directory(self, name):
|
||||||
directory_path = self.path(name)
|
directory_path = self.path(name)
|
||||||
|
try:
|
||||||
shutil.rmtree(directory_path)
|
shutil.rmtree(directory_path)
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ProblemDataError(Exception):
|
class ProblemDataError(Exception):
|
||||||
|
|
|
@ -98,11 +98,6 @@ class ContestSelect2View(Select2View):
|
||||||
return q
|
return q
|
||||||
|
|
||||||
|
|
||||||
class CommentSelect2View(Select2View):
|
|
||||||
def get_queryset(self):
|
|
||||||
return Comment.objects.filter(page__icontains=self.term)
|
|
||||||
|
|
||||||
|
|
||||||
class UserSearchSelect2View(BaseListView):
|
class UserSearchSelect2View(BaseListView):
|
||||||
paginate_by = 20
|
paginate_by = 20
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue