diff --git a/dmoj/urls.py b/dmoj/urls.py index df3d293..69558ba 100644 --- a/dmoj/urls.py +++ b/dmoj/urls.py @@ -77,7 +77,6 @@ from judge.views.register import ActivationView, RegistrationView from judge.views.select2 import ( AssigneeSelect2View, ChatUserSearchSelect2View, - CommentSelect2View, ContestSelect2View, ContestUserSearchSelect2View, OrganizationSelect2View, @@ -1066,9 +1065,6 @@ urlpatterns = [ url( r"^contest/$", ContestSelect2View.as_view(), name="contest_select2" ), - url( - r"^comment/$", CommentSelect2View.as_view(), name="comment_select2" - ), ] ), ), diff --git a/judge/admin/comments.py b/judge/admin/comments.py index 0b2a8e1..c33b683 100644 --- a/judge/admin/comments.py +++ b/judge/admin/comments.py @@ -12,7 +12,6 @@ class CommentForm(ModelForm): class Meta: widgets = { "author": AdminHeavySelect2Widget(data_view="profile_select2"), - "parent": AdminHeavySelect2Widget(data_view="comment_select2"), } if HeavyPreviewAdminPageDownWidget is not None: widgets["body"] = HeavyPreviewAdminPageDownWidget( @@ -39,7 +38,7 @@ class CommentAdmin(VersionAdmin): ) list_display = ["author", "linked_object", "time"] search_fields = ["author__user__username", "body"] - readonly_fields = ["score"] + readonly_fields = ["score", "parent"] actions = ["hide_comment", "unhide_comment"] list_filter = ["hidden"] actions_on_top = True diff --git a/judge/admin/interface.py b/judge/admin/interface.py index e82bb55..b377212 100644 --- a/judge/admin/interface.py +++ b/judge/admin/interface.py @@ -53,7 +53,8 @@ class NavigationBarAdmin(DraggableMPTTAdmin): class BlogPostForm(ModelForm): def __init__(self, *args, **kwargs): super(BlogPostForm, self).__init__(*args, **kwargs) - self.fields["authors"].widget.can_add_related = False + if "authors" in self.fields: + self.fields["authors"].widget.can_add_related = False class Meta: widgets = { diff --git a/judge/utils/problem_data.py b/judge/utils/problem_data.py index cd11fc4..5cf9fe7 100644 --- a/judge/utils/problem_data.py +++ b/judge/utils/problem_data.py @@ -51,7 +51,10 @@ class ProblemDataStorage(FileSystemStorage): def delete_directory(self, name): directory_path = self.path(name) - shutil.rmtree(directory_path) + try: + shutil.rmtree(directory_path) + except FileNotFoundError: + pass class ProblemDataError(Exception): diff --git a/judge/views/select2.py b/judge/views/select2.py index 1aea075..62a850c 100644 --- a/judge/views/select2.py +++ b/judge/views/select2.py @@ -98,11 +98,6 @@ class ContestSelect2View(Select2View): return q -class CommentSelect2View(Select2View): - def get_queryset(self): - return Comment.objects.filter(page__icontains=self.term) - - class UserSearchSelect2View(BaseListView): paginate_by = 20