def avatar_url(self): """ :return: avatar image url """ return url_for("api.Photo", image_hash_id=encode_id_to_str(self.image_id), _external=True)
def avatar_image(self): """ avatar image """ if not self.avatar: return self._gen_email_hashgravatar(1000) else: return url_for( "api.Photo", image_hash_id=encode_id_to_str(self.avatar_image_id), _external=True, )
def get_pagination_resource_fields(resource_fields): return { "items": fields.List(fields.Nested(resource_fields)), "prev": fields.String, "next": fields.String, "first": fields.String, "last": fields.String, "total": fields.Integer, "pages": fields.Integer, } movie_summary_resource_fields = { "id": fields.String(attribute=lambda x: encode_id_to_str(x.id)), "year": fields.Integer, "title": fields.String, "subtype": fields.String, "image_url": fields.String, "score": fields.Float, } celebrity_summary_resource_fields = { "id": fields.String(attribute=lambda x: encode_id_to_str(x.id)), "name": fields.String, "avatar_url": fields.String, } country_resource_fields = { "id": fields.String(attribute=lambda x: encode_id_to_str(x.id)),
def image_url(self): return url_for("api.Photo", image_hash_id=encode_id_to_str(self.image_id), _external=True)