Skip to content

Commit

Permalink
fix for problems without contests
Browse files Browse the repository at this point in the history
  • Loading branch information
Atanazyy committed Dec 27, 2024
1 parent d5b72ef commit a152009
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions oioioi/problems/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ def has_delete_permission(self, request, obj=None):
form=OriginTagThroughForm,
verbose_name=_("origin tag"),
verbose_name_plural=_("origin tags"),
has_permission_func=lambda self, request, obj=None: request.user.is_superuser,
)
class OriginTagInline(admin.StackedInline):
pass
Expand Down Expand Up @@ -341,6 +342,7 @@ class OriginInfoCategoryAdmin(admin.ModelAdmin):
form=OriginInfoValueThroughForm,
verbose_name=_("origin information"),
verbose_name_plural=_("additional origin information"),
has_permission_func=lambda self, request, obj=None: request.user.is_superuser,
)
class OriginInfoValueInline(admin.StackedInline):
pass
Expand Down Expand Up @@ -462,6 +464,8 @@ def has_change_permission(self, request, obj=None):
return can_modify_tags(request, obj)

def has_delete_permission(self, request, obj=None):
if obj is None:
return self.get_queryset(request).exists()
return can_admin_problem(request, obj)

def redirect_to_list(self, request, problem):
Expand Down

0 comments on commit a152009

Please sign in to comment.