def get_materials(obj): # 节目单关联素材 materials_related = obj.secondarywelfareprogrammematerial_set.all() materials = [{ 'title_md5': get_md5(material.material.files.url.split('/')[-1]), 'file': material.material.files.url } for material in materials_related] return materials
def get_materials(self, obj): # 二维码节目单关联素材 materials_related = obj.qrcodeprogrammematerial_set.all() materials = [{ 'title_md5': get_md5(material.material.files.url.split('/')[-1]), 'file': material.material.files.url } for material in materials_related] return materials
def get_materials(self, obj): # 背景模板节目单关联素材 materials_related = obj.machinetemplatematerial_set.all() materials = [{ 'title_md5': get_md5(material.material.files.url.split('/')[-1]), 'file': material.material.files.url } for material in materials_related] return materials
def get_materials(self, obj): # 节目单关联素材 materials_related = obj.primarywelfareprogrammematerial_set.all() materials = [{ 'title_md5': get_md5(material.material.files.url.split('/')[-1]), 'file': material.material.files.url, 'play_time': material.play_time } for material in materials_related] return materials