def get_pins(self, obj): user = self.context['request'].user # Check if the request user is among the first five delegates in the organisation if can_manage_org(obj, user): return {'one': obj.pin_one, 'two': obj.pin_two} else: return None
def get_pins(self,obj): user = self.context['request'].user # Check if the request user is among the first five delegates in the organisation if can_manage_org(obj,user): return {'one': obj.pin_one, 'two': obj.pin_two} else: return None
def get_pins(self,obj): try: user = self.context['request'].user # Check if the request user is among the first five delegates in the organisation if can_manage_org(obj, user): return {'one': obj.admin_pin_one, 'two': obj.admin_pin_two, 'three': obj.user_pin_one, 'four': obj.user_pin_two} else: return None except KeyError: return None