# Add CSV Export to a Django App from a Linear Issue

An agent adds a members-only Export CSV link to a Django app's checks list, with seven tests, and the full suite passes at 1783 tests.

[Run this on Rush](https://cloud.getrush.ai/run/add-csv-export/django/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent reads `hc/front/views.py`, `hc/front/urls.py`, `templates/front/checks.html`, the `Check` model in `hc/api/models.py` and the fixtures in `hc/test.py` before writing. The checks page already guards access with `_get_project_for_user`, which lets the owner, members and superusers in and answers anyone else with a 404, so the new view reuses it rather than adding a second check.

It adds `export_checks_csv` at `/projects/<code>/checks/export.csv` with columns `name,status,last_ping,schedule`. Status comes from `get_status()`, a cron or OnCalendar check shows its expression and a simple check shows `timeout=<seconds>s`. A cell starting with `=`, `+`, `-`, `@`, tab or CR gets a leading `'` so a check name cannot become a spreadsheet formula.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "A Linear issue labeled agent says: \"Add CSV Export to a Django App. Add an Export CSV button on the project's checks list that downloads every check with name, status, last ping and schedule, limited to the project's members.\" Do the work in this repository, add tests for it, run python manage.py test, and open a pull request that links back to the issue.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

Tried on healthchecks/healthchecks at 930f239c: 4 files changed, 119 insertions(+) in `hc/front/views.py` (+36), `hc/front/urls.py` (+1), `templates/front/checks.html` (+4) and a new `hc/front/tests/test_export_checks_csv.py` (+78). The issue text was written for the trial and had no ID. The untouched clone passed 1776 tests once the agent built a Python 3.12 venv and installed `requirements-dev.txt`; after the change `python manage.py test` printed `OK` and `Found 1783 test(s).`, and the new file alone `Ran 7 tests in 0.124s`.

For the reviewer: read-only members can export too, and a simple check's schedule is its timeout with no grace period. The agent did not open the page in a browser, so the link's look is checked only by a template test.

## Run it on every Linear issue labeled agent

An automation with a `linear` trigger on `linear.issue.labeled` and the label `agent` runs the `linear-label-to-pr` recipe's prompt when someone in your Rush org labels a feature request. The issue's wording of the columns reaches the agent, so an issue that also asks for tags or the grace period gets them.

## Why run it on Rush?

An export endpoint is a quiet way to leak data across projects. The run proved the boundary with tests rather than prose: Charlie, with no membership, gets a 404, a logged-out request is redirected to login, and Bob's project's checks never appear in Alice's file.

## Frequently asked questions

### Why did the baseline fail at first?

The repository needs Python 3.12 and the sandbox had 3.11, then 8 tests errored on a missing `time_machine` from `requirements-dev.txt`. Both were environment problems; with them fixed the untouched clone passed.

### Why change names that start with a minus sign?

Spreadsheets run a cell starting with `=`, `+`, `-` or `@` as a formula. The `'` prefix keeps a hostile check name inert, at the cost of altering those names in the file. The agent flagged it as a choice.

## More Django jobs

- [Add Stripe Checkout to a Django App](https://getrush.ai/run/add-stripe-checkout/django/)
- [Answer Support Tickets from a Django Codebase](https://getrush.ai/run/answer-support-tickets-from-code/django/)
- [Explain the Architecture of a Django Codebase](https://getrush.ai/run/architecture-overview/django/)

## The same job on other stacks

- [Add CSV Export to a Django REST Framework API](https://getrush.ai/run/add-csv-export/django-rest-framework/)
- [Add CSV Export to a Quarkus REST API](https://getrush.ai/run/add-csv-export/quarkus/)
- [Add a CSV Export to a Symfony Admin Backend from a Linear Issue](https://getrush.ai/run/add-csv-export/symfony/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
