All jobs

Build an Admin Page in a Django App

After approval, an agent records Stripe payment failures in a new Django model and lists them in a read-only admin page; fundraising tests rise from 62 to 74.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The first turn reads fundraising/models.py, admin.py, views.py and tests/test_views.py and stops: WebhookHandler.payment_failed only emails the donor, and no model stores a failure. It proposes a PaymentFailure model with seven fields, deduplication on a unique stripe_event_id, 24-month retention, and access for is_staff plus a model permission, then ends the turn asking for approval.

A follow-up approved it as proposed. The second turn adds migration 0003_paymentfailure, records each failure with get_or_create before the email, registers a read-only PaymentFailureAdmin with a created date filter, and adds a prune_payment_failures command. To run the tests it extracted Debian's postgresql-15, which has pg_trgm, without root.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "Build an administrator-only page listing recent failed donation attempts with date filters. First inspect fundraising models, webhook handlers, existing admin registrations and tests. If failure history is not stored, propose the smallest recording change and end the turn waiting for a follow-up approving its fields, deduplication and retention; do not invent historical failures. After approval, follow the existing admin layout and enforce the approved admin role on the server. Test anonymous and non-admin refusal, no unauthorized data disclosure, date boundaries, empty state and duplicate events if recording changes. Use synthetic data for browser screenshots. Run the focused fundraising tests, migration checks and repository CI commands that the environment supports, reporting anything blocked. Ask before adding dependencies, preserve existing donation behavior, and open a pull request after verification.",
  "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 django/djangoproject.com at af691864: 10 files changed, 331 insertions(+), 2 deletions(-). python -m manage test fundraising went from Found 62 test(s). to Found 74 test(s)., ending OK (skipped=1), and makemigrations --check --dry-run printed No changes detected. make test ends FAILED (failures=3, errors=4, skipped=7) both before and after, and make ci stops at compilemessages because msgfmt is missing. No pull request was opened.

For the reviewer: failure_reason reads only last_payment_error or last_finalization_error from the invoice, so it is often blank; a reliable decline reason needs a Stripe API call the agent did not add. A redelivered event returns 204 without a second email, and nothing schedules prune_payment_failures yet.

Run it on every teammate's admin-page request

A teammate starts this prompt from the console in the Project that holds the repository. The run ends its first turn with the proposed fields and access rule; anyone in the org can read it, and its starter or an org admin sends the approval, or the changes, as a follow-up that starts the second turn.

The use case this job follows, with its automation and trigger: Steer a run as a team.

Why run it on Rush?

The page could not be built as asked, because the failures it lists were never stored. The run said so before writing code, and the approved design handles what Stripe actually sends: a redelivered event adds no row and no second email, while a retry of the same invoice, a new event, is kept as a new attempt. Tests cover both.

Frequently asked questions

Who can see the page?

An active staff user with the view_paymentfailure permission, and superusers. The tests check that anonymous users are redirected to login, and that a plain user, staff without the permission, and a user with the permission but no is_staff are refused without seeing the event id, reason or donor name.

Is there a from/to date form?

No. The page uses Django's DateFieldListFilter, the date_hierarchy drill-down and ?created__gte=…&created__lt=… in the URL, with no new dependency. With USE_TZ = False, boundaries are in server-local time, America/Chicago.

More Django jobs

The same job on other stacks

Keep reading