image_data = models.BinaryField(null=True) box.image_data = base64.b64encode(output.getvalue()) if self.image_data != None : return format_html("",self.image_data.decode('UTF-8'))