Skip to content

Conversation

@piotrjez
Copy link

@piotrjez piotrjez commented Nov 6, 2025

Description

Suggested documentation updates:

  1. Explicitly mention that Django’s middleware stack executes after the request_hook runs,
    so attributes like request.user or request.site are unavailable there.
  2. Add examples for AuthenticationMiddleware and CurrentSiteMiddleware showing how to capture
    enduser.id, enduser.username, site.id and site.domain in response_hook.
  3. Clarify that this pattern also applies to any custom middleware attaching data to the request object.
  4. Update links for Django docs to latest LTS version 5.2

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  1. Virtualenv in Python 3.11
  2. tox -e docs
  3. Check local build in docs/_build/html/instrumentation/*

Does This PR Require a Core Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 6, 2025

CLA Signed
The committers listed above are authorized under a signed CLA.

* `Django Response object <https://docs.djangoproject.com/en/5.2/ref/request-response/#httpresponse-objects>`_
Adding attributes from middleware context
********************************************************************************
Copy link
Contributor

@tammy-baylis-swi tammy-baylis-swi Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this helpful update!

Would it make sense to have this and the other new sections be subsections under Request and Response hooks? so e.g.

Suggested change
********************************************************************************
################################################################################
Copy link
Contributor

@xrmx xrmx Nov 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be as long as the title, also the other titles have the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants