if key == 'user__username': return True return super(SubmissionAdmin, self).lookup_allowed(key, value) def change_view(self, request, object_id, form_url='', extra_context=None): return redirect('submission', contest_id=request.contest.id, submission_id=unquote(object_id)) admin.site.register(Submission, SubmissionAdmin) contest_admin_menu_registry.register('submissions_admin', _("Submissions"), lambda request: reverse('oioioiadmin:contests_submission_changelist'), order=40) contest_observer_menu_registry.register('submissions_admin', _("Submissions"), lambda request: reverse('oioioiadmin:contests_submission_changelist'), order=40) class RoundListFilter(SimpleListFilter): title = _("round") parameter_name = 'round' def lookups(self, request, model_admin): qs = model_admin.queryset(request) return Round.objects.filter(id__in=qs.values_list('round')) \ .values_list('id', 'name') def queryset(self, request, queryset): if self.value(): return queryset.filter(round=self.value())
return redirect('submission', contest_id=_contest_id, submission_id=unquote(object_id)) contest_site.register(Submission, SubmissionAdmin) contest_admin_menu_registry.register( 'submissions_admin', _("Submissions"), lambda request: reverse('oioioiadmin:contests_submission_changelist'), order=40) contest_observer_menu_registry.register( 'submissions_admin', _("Submissions"), lambda request: reverse('oioioiadmin:contests_submission_changelist'), order=40) admin.system_admin_menu_registry.register( 'managesubmissions_admin', _("All submissions"), lambda request: reverse('oioioiadmin:contests_submission_changelist', kwargs={'contest_id': None}), order=50) class RoundTimeRoundListFilter(SimpleListFilter): title = _("round") parameter_name = 'round'