tcms.core.contrib.linkreference.views module

tcms.core.contrib.linkreference.views.add(request)[source]

Add new link to a specific target

The target should be a valid model within TCMS, which are documented in LINKREF_TARGET.

Incoming request should be a POST request, and contains following arguments:

  • target: To which the new link will link to. The available target names are documented in the LINKREF_TARGET.
  • target_id: the ID used to construct the concrete target instance, to which the new link will be linked.
  • name: a short description to this new link, and accept 64 characters at most.
  • url: the actual URL.
tcms.core.contrib.linkreference.views.remove(_request, link_id)[source]

Remove a specific link with ID link_id

tcms.core.contrib.linkreference.views.create_link(data)[source]

Create a link reference to an object. data is a dict with the following keys:

Parameters:
  • name (str) – name of the reference
  • url (str) – URL
  • target_id (int) – PK of the object we link to
Returns:

Data suitable for JSON response to clients

Return type:

dict