Skip to content

feat: show the site of every endpoint in the statistics - #2

Merged
urtzai merged 1 commit into
mainfrom
feat/site-column
Oct 8, 2026
Merged

urtzai merged 1 commit into
mainfrom
feat/site-column

Conversation

@urtzai

@urtzai urtzai commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Why

Several front ends (several django.contrib.sites) can call the same backend, and Endpoint.site_id was recorded but invisible: the stats changelist did not show it and there was no filter, while the Endpoints list showed a raw number.

What

  • Site column in the Endpoint stats and Endpoints changelists. It shows the domain (foo.com) when django.contrib.sites is installed, and falls back to the raw id when it is not — the package still does not require the sites framework.
  • Site filter in both changelists, listing the sites by domain.
  • The labels are read per row, so they are cached for a minute: the table is tiny and changes very rarely. reset_site_labels_cache() clears it (used by the tests).
  • The CSV export keeps site_id as it was.

Tests

  • New tests/test_sites.py: the column shows the domain in both changelists, the filter narrows to one site, and it offers every site by domain.
  • The test settings now install django.contrib.sites (SITE_ID = 1).
  • 85 tests, green on Django 4.2 and 5.2; ruff and black clean.

Also

Version bumped to 0.1.9. The release stays gated: no GitHub release or PyPI publish until it is reviewed.

Note

The request mentioned one more thing after "…they probably also get made towards the frontend and" — if there is more to it, tell me and I will extend this PR.

Endpoint.site_id was recorded but invisible in the stats: the changelist did not
show it and there was no filter, and the Endpoints list showed a raw number.

- Site column in both changelists, showing the domain when
  django.contrib.sites is installed (the raw id otherwise)
- Site filter in both, listing the sites by domain
- The labels are cached for a minute: the table is tiny and read per row
- 85 tests (the test settings now install django.contrib.sites)
@urtzai
urtzai merged commit 7cd9f84 into main Oct 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant