mirror of
https://github.com/jazzband/django-auditlog.git
synced 2026-03-16 22:20:26 +00:00
fix: don't set the correlation_id if the AUDITLOG_CID_GETTER is None (#565)
This commit is contained in:
parent
e1485104f8
commit
6f7a758a48
2 changed files with 19 additions and 3 deletions
15
CHANGELOG.md
15
CHANGELOG.md
|
|
@ -2,11 +2,22 @@
|
|||
|
||||
## Next Release
|
||||
|
||||
#### Improvements
|
||||
- Python: Confirm Python 3.12 support ([#572](https://github.com/jazzband/django-auditlog/pull/572))
|
||||
|
||||
## 3.0.0-beta.2 (2023-10-05)
|
||||
|
||||
#### Breaking Changes
|
||||
- feat: stop deleting old log entries when a model with the same pk is created (i.e. the pk value is reused) ([#559](https://github.com/jazzband/django-auditlog/pull/559))
|
||||
|
||||
#### Fixes
|
||||
* fix: don't set the correlation_id if the `AUDITLOG_CID_GETTER` is `None` ([#565](https://github.com/jazzband/django-auditlog/pull/565))
|
||||
|
||||
## 3.0.0-beta.1
|
||||
|
||||
#### Breaking Changes
|
||||
|
||||
- Python: Confirm Python 3.12 support ([#572](https://github.com/jazzband/django-auditlog/pull/572))
|
||||
- feat: Change `LogEntry.change` field type to `JSONField` rather than `TextField`. This change include a migration that may take time to run depending on the number of records on your `LogEntry` table ([#407](https://github.com/jazzband/django-auditlog/pull/407))([#495](https://github.com/jazzband/django-auditlog/pull/495))
|
||||
- feat: stop deleting old log entries when a model with the same pk is created (i.e. the pk value is reused) ([#559](https://github.com/jazzband/django-auditlog/pull/559))
|
||||
- feat: Set `AuditlogHistoryField.delete_related` to `False` by default. This is different from the default configuration of Django's `GenericRelation`, but we should not erase the audit log of objects on deletion by default. ([#557](https://github.com/jazzband/django-auditlog/pull/557))
|
||||
- Python: Drop support for Python 3.7 ([#546](https://github.com/jazzband/django-auditlog/pull/546))
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,16 @@ def set_cid(request: Optional[HttpRequest] = None) -> None:
|
|||
A function to read the cid from a request.
|
||||
If the header is not in the request, then we set it to `None`.
|
||||
|
||||
Note: we look for the header in `request.headers` and `request.META`.
|
||||
Note: we look for the value of `AUDITLOG_CID_HEADER` in `request.headers` and in `request.META`.
|
||||
|
||||
This function doesn't do anything if the user is supplying their own `AUDITLOG_CID_GETTER`.
|
||||
|
||||
:param request: The request to get the cid from.
|
||||
:return: None
|
||||
"""
|
||||
if settings.AUDITLOG_CID_GETTER:
|
||||
return
|
||||
|
||||
cid = None
|
||||
header = settings.AUDITLOG_CID_HEADER
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue