code: def csv_list(models, attr, link=False, separator=", "):
      
      values = []
      for model in models:
          value = getattr(model, attr)
          if link and hasattr(model, "get_admin_url") and callable(model.get_admin_url):
              value = get_admin_html_link(model, label=value)
          values.append(value)
      return separator.join(values)
docs: Return a comma-separated list of models, optionaly with a link.