Tracking different fields depending on event #151
-
https://django-pghistory.readthedocs.io/en/3.0.0/event_tracking/#tracking-specific-fields I'd like to track a few fields of insert/update, and all fields for delete. Is that possible? |
Beta Was this translation helpful? Give feedback.
Answered by
wesleykendall
Sep 2, 2024
Replies: 1 comment
-
Yes, use multiple invocations of @pghistory.track(
pghistory.InsetEvent(), pghistory.UpdateEvent(),
fields=["int_field"],
model_name="MyTrackedModelInsertUpdateHistory"
)
@pghistory.track(
pghistory.DeleteEvent(),
fields=["int_field", "char_field"],
model_name="MyTrackedModelDeleteHistory"
)
class MyTrackedModel(models.Model):
int_field = models.IntegerField()
char_field = models.TextField() Each invocation of A short section for multiple trackers was added in #142 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
wesleykendall
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, use multiple invocations of
@pghistory.track
:Each invocation of
track
is associated with a different event model.A short section for multiple trackers was added in #142