{"action":"created","issue":{"url":"https://api.github.com/repos/algolia/algoliasearch-django/issues/13","repository_url":"https://api.github.com/repos/algolia/algoliasearch-django","labels_url":"https://api.github.com/repos/algolia/algoliasearch-django/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/algolia/algoliasearch-django/issues/13/comments","events_url":"https://api.github.com/repos/algolia/algoliasearch-django/issues/13/events","html_url":"https://github.com/algolia/algoliasearch-django/issues/13","id":100029346,"number":13,"title":"Handle foreign key automatically","user":{"login":"maxiloc","id":1689007,"avatar_url":"https://avatars.githubusercontent.com/u/1689007?v=3","gravatar_id":"","url":"https://api.github.com/users/maxiloc","html_url":"https://github.com/maxiloc","followers_url":"https://api.github.com/users/maxiloc/followers","following_url":"https://api.github.com/users/maxiloc/following{/other_user}","gists_url":"https://api.github.com/users/maxiloc/gists{/gist_id}","starred_url":"https://api.github.com/users/maxiloc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxiloc/subscriptions","organizations_url":"https://api.github.com/users/maxiloc/orgs","repos_url":"https://api.github.com/users/maxiloc/repos","events_url":"https://api.github.com/users/maxiloc/events{/privacy}","received_events_url":"https://api.github.com/users/maxiloc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-08-10T10:24:55Z","updated_at":"2016-04-23T05:47:59Z","closed_at":null,"body":"Might be the same as #2"},"comment":{"url":"https://api.github.com/repos/algolia/algoliasearch-django/issues/comments/213669699","html_url":"https://github.com/algolia/algoliasearch-django/issues/13#issuecomment-213669699","issue_url":"https://api.github.com/repos/algolia/algoliasearch-django/issues/13","id":213669699,"user":{"login":"calitidexvii","id":5874195,"avatar_url":"https://avatars.githubusercontent.com/u/5874195?v=3","gravatar_id":"","url":"https://api.github.com/users/calitidexvii","html_url":"https://github.com/calitidexvii","followers_url":"https://api.github.com/users/calitidexvii/followers","following_url":"https://api.github.com/users/calitidexvii/following{/other_user}","gists_url":"https://api.github.com/users/calitidexvii/gists{/gist_id}","starred_url":"https://api.github.com/users/calitidexvii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/calitidexvii/subscriptions","organizations_url":"https://api.github.com/users/calitidexvii/orgs","repos_url":"https://api.github.com/users/calitidexvii/repos","events_url":"https://api.github.com/users/calitidexvii/events{/privacy}","received_events_url":"https://api.github.com/users/calitidexvii/received_events","type":"User","site_admin":false},"created_at":"2016-04-23T05:47:59Z","updated_at":"2016-04-23T05:47:59Z","body":"For anyone else needing a workaround, I was able to use callables within the model for the index.\r\n\r\n```\r\nclass Comment(models.Model):\r\n    user = models.ForeignKey(User)\r\n    raw_message = models.TextField()\r\n\r\n    def user_filter(self):\r\n        return [self.user.username]\r\n```\r\n\r\nThen the index:\r\n\r\n```\r\nclass CommentIndex(AlgoliaIndex):\r\n    fields = ('raw_message')\r\n    tags = 'user_filter'\r\n```\r\n\r\nThis isn't perfect and may not work in all situations, but it seems to be sufficient when you need to manage user access with [secured API keys](https://www.algolia.com/doc/python#security--user-api-keys)."}}