Esempio n. 1
0
    def destroy(self, request, *args, **kwargs):
        iotd: Iotd = self.get_object()

        may, reason = may_unelect_iotd(request.user, iotd.image)

        if not may:
            return HttpResponseForbidden(reason)

        return super().destroy(request, *args, **kwargs)
Esempio n. 2
0
def may_not_unelect_reason(user, image):
    may, reason = may_unelect_iotd(user, image)
    return reason
Esempio n. 3
0
def may_unelect(user, image):
    may, reason = may_unelect_iotd(user, image)
    return may