# Get all the users that have followed a specific user (user1). This might# look a bit confusing at first, but can be very useful.# The objects_represented filter allows filtering a given queryset to contain# only elements that have a specific papertrail entry pointing at them.all_users = get_user_model().objects.all()users_who_followed_user1 = (papertrail # Narrow down to only user-followed entries that followed user1 .filter(type='user-followed') .related_to(following=user1) # Return a User queryset that only has the users for which we have a # user-followed entry that has a followed target pointing at them .objects_represented(all_users, 'followed'))

# objects_not_represented does the same, but returns a queryset that# excludes any object that has a papertrail entry pointing at it:# Get all users who never logged inusers_who_never_logged_in = (papertrail .filter(type='user-logged-in') .objects_not_represented(all_users, 'user'))```

## Admin integration

`django-papertrail` provides a Django admin integration to both view entries(simple Django admin Entry list, usually available under /admin/papertrail/entry/)as well as a more advanced intergration for objects you want to keep track of.

The advanced integration provides two useful functionalities:

1) Change tracking - whenever an object for which the integration is enabled is added/edited/deleted, a papertrail entry will be created2) A convenient link to view all papertrail entries pointing to the object being viewed as well as an integrated papertrail viewer: