コード例 #1
0
ファイル: users.py プロジェクト: havanhuy1997/pmg-cms-2
 def to_dict(self, include_related=False):
     tmp = serializers.model_to_dict(self, include_related=include_related)
     # send subscriptions back as a dict
     subscription_dict = {}
     if tmp.get('subscriptions'):
         for committee in tmp['subscriptions']:
             subscription_dict[committee['id']] = committee.get('name')
     tmp['subscriptions'] = subscription_dict
     # set 'has_expired' flag as appropriate
     tmp['has_expired'] = self.has_expired()
     return tmp
コード例 #2
0
ファイル: users.py プロジェクト: Code4SA/pmg-cms-2
 def to_dict(self, include_related=False):
     tmp = serializers.model_to_dict(self, include_related=include_related)
     # send subscriptions back as a dict
     subscription_dict = {}
     if tmp.get('subscriptions'):
         for committee in tmp['subscriptions']:
             subscription_dict[committee['id']] = committee.get('name')
     tmp['subscriptions'] = subscription_dict
     # set 'has_expired' flag as appropriate
     tmp['has_expired'] = self.has_expired()
     return tmp
コード例 #3
0
ファイル: resources.py プロジェクト: kollinsayz/pmg-cms-2
    def to_dict(self, include_related=False):
        tmp = serializers.model_to_dict(self, include_related=include_related)

        tmp['questions_url'] = url_for('api.member_questions', member_id=self.id, _external=True)
        tmp['attendance_url'] = url_for('api.member_attendance', member_id=self.id, _external=True)

        if tmp['profile_pic_url']:
            tmp['profile_pic_url'] = STATIC_HOST + tmp['profile_pic_url']

        if tmp['pa_link']:
            tmp['pa_url'] = self.pa_url

        return tmp
コード例 #4
0
ファイル: users.py プロジェクト: havanhuy1997/pmg-cms-2
    def to_dict(self, include_related=False):
        tmp = serializers.model_to_dict(self, include_related=include_related)
        tmp.pop('password')
        tmp.pop('last_login_ip')
        tmp.pop('current_login_ip')
        tmp.pop('last_login_at')
        tmp.pop('current_login_at')
        tmp.pop('confirmed_at')
        tmp.pop('login_count')
        tmp['has_expired'] = self.has_expired()

        # send committee alerts back as a dict
        alerts_dict = {}
        if tmp.get('committee_alerts'):
            for committee in tmp['committee_alerts']:
                alerts_dict[committee['id']] = committee.get('name')
        tmp['committee_alerts'] = alerts_dict
        return tmp
コード例 #5
0
ファイル: users.py プロジェクト: Code4SA/pmg-cms-2
    def to_dict(self, include_related=False):
        tmp = serializers.model_to_dict(self, include_related=include_related)
        tmp.pop('password')
        tmp.pop('last_login_ip')
        tmp.pop('current_login_ip')
        tmp.pop('last_login_at')
        tmp.pop('current_login_at')
        tmp.pop('confirmed_at')
        tmp.pop('login_count')
        tmp['has_expired'] = self.has_expired()

        # send committee alerts back as a dict
        alerts_dict = {}
        if tmp.get('committee_alerts'):
            for committee in tmp['committee_alerts']:
                alerts_dict[committee['id']] = committee.get('name')
        tmp['committee_alerts'] = alerts_dict
        return tmp
コード例 #6
0
ファイル: resources.py プロジェクト: kollinsayz/pmg-cms-2
 def to_dict(self, include_related=False):
     tmp = serializers.model_to_dict(self, include_related=include_related)
     tmp['questions_url'] = url_for('api.committee_questions', committee_id=self.id, _external=True)
     return tmp
コード例 #7
0
ファイル: resources.py プロジェクト: kollinsayz/pmg-cms-2
 def to_dict(self, include_related=False):
     tmp = serializers.model_to_dict(self, include_related=include_related)
     return tmp
コード例 #8
0
ファイル: resources.py プロジェクト: kollinsayz/pmg-cms-2
 def to_dict(self, include_related=False):
     tmp = serializers.model_to_dict(self, include_related=include_related)
     tmp['url'] = self.url
     return tmp
コード例 #9
0
 def to_dict(self, include_related=False):
     tmp = serializers.model_to_dict(self, include_related=include_related)
     return tmp
コード例 #10
0
ファイル: models.py プロジェクト: Code4SA/med-db
 def to_dict(self, include_related=False):
     return serializers.model_to_dict(self)