Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/event_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ Use `None` to ignore creating the `pgh_obj` field on the event model.

## `pgh_context` Field

The default `pgh_context` field of event models can be set with `settings.PGH_CONTEXT_FIELD` or by supplying the `context_field` argument to [pghistory.track][] or [pghistory.create_event_model][]. It must be set to either a [pghistory.ContextForeignKey][] or [pghistory.ContextJSONField][] instance. When using the former, event models will reference a shared [pghistory.context][] model. When using the latter, context will be denormalized. We discuss this in detail in [Denormalizing Context](#denormalizing_context).
The default `pgh_context` field of event models can be set with `settings.PGHISTORY_CONTEXT_FIELD` or by supplying the `context_field` argument to [pghistory.track][] or [pghistory.create_event_model][]. It must be set to either a [pghistory.ContextForeignKey][] or [pghistory.ContextJSONField][] instance. When using the former, event models will reference a shared [pghistory.context][] model. When using the latter, context will be denormalized. We discuss this in detail in [Denormalizing Context](#denormalizing_context).

By default, the context foreign key object uses `null=True` to ensure that context is optional.

Similar to `pgh_obj`, the `pgh_context` argument and setting can be `None` if one wishes to ignore context tracking.

## `pgh_context_id` Field

When denormalizing context, one can configure the default ID field used with `settings.PGH_CONTEXT_ID_FIELD` or by supplying the `context_id_field` to [pghistory.track][] or [pghistory.create_event_model][]. It must be set to a [pghistory.ContextUUIDField][] instance. We discuss this in detail in the [Denormalizing Context](#denormalizing_context) subsection.
When denormalizing context, one can configure the default ID field used with `settings.PGHISTORY_CONTEXT_ID_FIELD` or by supplying the `context_id_field` to [pghistory.track][] or [pghistory.create_event_model][]. It must be set to a [pghistory.ContextUUIDField][] instance. We discuss this in detail in the [Denormalizing Context](#denormalizing_context) subsection.

Set this to `None` to ignore storing the ID when denormalizing context.

Expand Down
4 changes: 2 additions & 2 deletions docs/event_tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,8 @@ from django.contrib.auth.models import User
import pghistory

@pghistory.track(
pghistory.AfterInsert("group.add"),
pghistory.BeforeDelete("group.remove"),
pghistory.InsertEvent("group.add"),
pghistory.DeleteEvent("group.remove"),
obj_field=None,
)
class UserGroups(User.groups.through):
Expand Down