A Django mixin and middleware for linking graphs to objects