<a id="project-ticket-template-context"></a>
<a id="template-context-project-tickets"></a>
# Project Ticket Template Context

The following additional context variables are available in templates with a scope of *Project Tickets*, on top of the values listed in [Template Context](template_context.html.md#template-context).

> **Important:** When running document templates in testing from the document template editor the filter_assignments are set to "All", filter_labels are set to empty list, search_text is empty string, filtered_ids is an empty list and ticket_page is set to "All".

- **Name:** project

  **Description:** A [project](attribute_reference.html.md#attribute-project) reference. The root object from which Project properties and sub objects such as lists of Drafts or Tickets can be accessed.

  *The project variable is only available when the document template scope is of type Project Home or Project Tickets*

  **Example:**

  ```jinja
  {{ project.ProjectName }}
  ```

- **Name:** filter_assignments

  **Description:** The assignment filter selected in the ticket view that the document was generated from. Can be one of "All", "Unassigned" or "Assigned to me". Defaults to "All".

  **Example:**

  ```jinja
  Assignments Filter : {{ filter_assignments }} {# All, Unassigned, Assigned to me #}
  ```

- **Name:** filter_labels

  **Description:** A list of labels which the ticket view is being filtered by. Empty list if view not being filtered by label.

  **Example:**

  ```jinja
  {{ ", ".join(filter_labels) or 'None' }}
  ```

- **Name:** filtered_ids

  **Description:** Database ids of the records which are viewable in the ticket view that the document was generated from. This allows the document template author to report on just the tickets that the user has the view filtered to.

  **Example:**

  ```jinja
  {% for ticket in project.ticket_set.filter(id__in=filtered_ids).order_by('iid') %}
  ```

- **Name:** search_text

  **Description:** The contents of the "search" box on the ticket view that the document was generated from

  **Example:**

  ```jinja
  Active Search: {{ search_text or 'None' }}
  ```

- **Name:** ticket_page

  **Description:** The sub-page of the ticket view that the document was generated from. Can be "open", "closed" or "all"

  **Example:**

  ```jinja
  Ticket Page: {{ ticket_page.title() }}
  ```
