Make LogEntry and middleware compatible with custom user models