def post(self, request, *args, **kwargs): stuck_reg = self.get_object() if Registration.find_failed_registrations().filter(id=stuck_reg.id).exists(): stuck_reg.delete_registration_tree(save=True) messages.success(request, 'The registration has been deleted') else: messages.error(request, 'This registration may not technically be stuck,' ' if the problem persists get a developer to fix it.') return redirect(reverse_node(self.kwargs.get('guid')))
def get_queryset(self): return Registration.find_failed_registrations().order_by(self.ordering)