def template_assets_path(instance, filename):
 name = os.path.join('certificate_template_assets', str(instance.id), filename)
 fullname = os.path.join(settings.MEDIA_ROOT, name)
 if os.path.exists(fullname):
  os.remove(fullname)
 return name

def template_assets_path ( instance , filename ) : name = os . path . join ( 'certificate_template_assets' , str ( instance . id ) , filename ) fullname = os . path . join ( settings . MEDIA_ROOT , name ) if os . path . exists ( fullname ) : os . remove ( fullname ) return name
delete the file if it already exist and returns the certificate template asset file path .