def post(self, request, *args, **kwargs): oracle = OracleHandler() old_status = oracle.member_status(request.user.contract_address, only_index=True) new_status = int(request.POST.get('status')) if new_status != old_status: change_member_status.delay(request.user.id, new_status) return super().get(request, *args, **kwargs)
def member_status(context, member, for_change=False): oracle = OracleHandler() status = oracle.member_status(member.contract_address) return { 'statuses': [{ 'id': i, 'status': v } for i, v in enumerate(oracle.statuses)], 'status': status, 'for_change': for_change, 'now_pending': context['txns'].filter(txn_type='ChangeStatus').exists() }