コード例 #1
0
ファイル: serializers.py プロジェクト: ScottEvansDBCA/ledger
 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
コード例 #2
0
ファイル: serializers.py プロジェクト: wilsonc86/ledger
 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
コード例 #3
0
 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