Skip to content
admin.py 28.5 KiB
Newer Older
        qs = super(ExamTicketAdmin, self).get_queryset(request)
        return _filter_participation_linked_obj_for_user(qs, request.user)

    exclude = ("creator",)

    def save_model(self, request, obj, form, change):
        obj.creator = request.user
        obj.save()

    # }}}

    def revoke_exam_tickets(self, request, queryset):  # noqa
        queryset \
                .filter(state=exam_ticket_states.valid) \
                .update(state=exam_ticket_states.revoked)

    revoke_exam_tickets.short_description = _("Revoke Exam Tickets")  # type: ignore

    actions = [revoke_exam_tickets]

admin.site.register(ExamTicket, ExamTicketAdmin)

# }}}

# vim: foldmethod=marker