def make_records(): for vol, rec in Tracker(iter=generate_image_records(), report_every=100): if rec.instrument_name == 'MOC-NA': a = Asset() a.volume = vol a.product_id = rec.product_id a.instrument_name = rec.instrument_name a.footprint = build_footprint(rec) a.relative_file_path = os.path.join(vol, rec.file_specification_name) a.save()