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
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
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
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
def to_dict(self, include_related=False): tmp = serializers.model_to_dict(self, include_related=include_related) return tmp
def to_dict(self, include_related=False): tmp = serializers.model_to_dict(self, include_related=include_related) tmp['url'] = self.url return tmp
def to_dict(self, include_related=False): return serializers.model_to_dict(self)