GitHub PullRequestEvent at 2014-10-22 07:27:52
Repository: django-hvad
Actor: aykut
Payload: {"action":"opened","number":206,"pull_request":{"url":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/206","id":23139201,"html_url":"https://github.com/KristianOellegaard/django-hvad/pull/206","diff_url":"https://github.com/KristianOellegaard/django-hvad/pull/206.diff","patch_url":"https://github.com/KristianOellegaard/django-hvad/pull/206.patch","issue_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/issues/206","number":206,"state":"open","locked":false,"title":"AttributeError: 'function' object has no attribute 'real'","user":{"login":"spectras","id":5879675,"avatar_url":"https://avatars.githubusercontent.com/u/5879675?v=2","gravatar_id":"","url":"https://api.github.com/users/spectras","html_url":"https://github.com/spectras","followers_url":"https://api.github.com/users/spectras/followers","following_url":"https://api.github.com/users/spectras/following{/other_user}","gists_url":"https://api.github.com/users/spectras/gists{/gist_id}","starred_url":"https://api.github.com/users/spectras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spectras/subscriptions","organizations_url":"https://api.github.com/users/spectras/orgs","repos_url":"https://api.github.com/users/spectras/repos","events_url":"https://api.github.com/users/spectras/events{/privacy}","received_events_url":"https://api.github.com/users/spectras/received_events","type":"User","site_admin":false},"body":"Hi,\r\n\r\nI've the following models.\r\n\r\n```\r\nclass UserProfile(models.Model):\r\n    user = OneToOneField('auth.User')\r\n    ...\r\n\r\nclass Review(TranslatableModel):\r\n    translations = ...\r\n    userprofile = models.ForeignKey(UserProfile)\r\n    ...\r\n```\r\n\r\nWhen I try to query ``Reviw.objects.language('en').all().select_related('userprofile__user')``, I get the error below:\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/core/handlers/base.py\", line 114, in get_response\r\n    response = wrapped_callback(request, *callback_args, **callback_kwargs)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/rest_framework/viewsets.py\", line 78, in view\r\n    return self.dispatch(request, *args, **kwargs)\r\n  File \"/Users/aykutozat/gezi/gezi/apps/api/v1/decorators.py\", line 15, in inner_decorator\r\n    return func(self, request, *args, **kwargs)\r\n  File \"/Users/aykutozat/gezi/gezi/apps/api/v1/mixins.py\", line 82, in dispatch\r\n    request, *args, **kwargs)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/views/decorators/csrf.py\", line 57, in wrapped_view\r\n    return view_func(*args, **kwargs)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/rest_framework/views.py\", line 400, in dispatch\r\n    response = self.handle_exception(exc)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/rest_framework/views.py\", line 397, in dispatch\r\n    response = handler(request, *args, **kwargs)\r\n  File \"/Users/aykutozat/gezi/gezi/apps/api/v1/mixins.py\", line 117, in reviews\r\n    page = paginator.page(page_num)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/core/paginator.py\", line 50, in page\r\n    number = self.validate_number(number)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/core/paginator.py\", line 39, in validate_number\r\n    if number > self.num_pages:\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/core/paginator.py\", line 86, in _get_num_pages\r\n    if self.count == 0 and not self.allow_empty_first_page:\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/core/paginator.py\", line 77, in _get_count\r\n    self._count = len(self.object_list)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/db/models/query.py\", line 77, in __len__\r\n    self._fetch_all()\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/django/db/models/query.py\", line 854, in _fetch_all\r\n    self._result_cache = list(self.iterator())\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/hvad/manager.py\", line 464, in iterator\r\n    qs = self._clone()._add_language_filter()\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/hvad/manager.py\", line 405, in _add_language_filter\r\n    self._add_select_related(language_code)\r\n  File \"/Users/aykutozat/.virtualenvs/gezi/lib/python2.7/site-packages/hvad/manager.py\", line 318, in _add_select_related\r\n    for query_key in fields:\r\nAttributeError: 'function' object has no attribute 'real'\r\n```\r\n\r\nWhen I debug down to line 324 in ``_add_select_related`` method, I realize that model is ``UserProfile`` which is not a translatable model at ``field, _, direct, _ = model._meta.get_field_by_name.real(bit)``.\r\n\r\nThank you.\r\nAykut","created_at":"2014-10-22T07:27:52Z","updated_at":"2014-10-22T07:27:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":{"login":"spectras","id":5879675,"avatar_url":"https://avatars.githubusercontent.com/u/5879675?v=2","gravatar_id":"","url":"https://api.github.com/users/spectras","html_url":"https://github.com/spectras","followers_url":"https://api.github.com/users/spectras/followers","following_url":"https://api.github.com/users/spectras/following{/other_user}","gists_url":"https://api.github.com/users/spectras/gists{/gist_id}","starred_url":"https://api.github.com/users/spectras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spectras/subscriptions","organizations_url":"https://api.github.com/users/spectras/orgs","repos_url":"https://api.github.com/users/spectras/repos","events_url":"https://api.github.com/users/spectras/events{/privacy}","received_events_url":"https://api.github.com/users/spectras/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/KristianOellegaard/django-hvad/milestones/3","labels_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/milestones/3/labels","id":785984,"number":3,"title":"v0.6.0","description":"","creator":{"login":"spectras","id":5879675,"avatar_url":"https://avatars.githubusercontent.com/u/5879675?v=2","gravatar_id":"","url":"https://api.github.com/users/spectras","html_url":"https://github.com/spectras","followers_url":"https://api.github.com/users/spectras/followers","following_url":"https://api.github.com/users/spectras/following{/other_user}","gists_url":"https://api.github.com/users/spectras/gists{/gist_id}","starred_url":"https://api.github.com/users/spectras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spectras/subscriptions","organizations_url":"https://api.github.com/users/spectras/orgs","repos_url":"https://api.github.com/users/spectras/repos","events_url":"https://api.github.com/users/spectras/events{/privacy}","received_events_url":"https://api.github.com/users/spectras/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":3,"state":"open","created_at":"2014-09-11T09:09:22Z","updated_at":"2014-10-22T07:03:23Z","due_on":null},"commits_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/206/commits","review_comments_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/206/comments","review_comment_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/comments/{number}","comments_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/issues/206/comments","statuses_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/statuses/121fa636f1e2cf38b57579db2254bb0e76a8b339","head":{"label":"spectras:fix/regular_select_related","ref":"fix/regular_select_related","sha":"121fa636f1e2cf38b57579db2254bb0e76a8b339","user":{"login":"spectras","id":5879675,"avatar_url":"https://avatars.githubusercontent.com/u/5879675?v=2","gravatar_id":"","url":"https://api.github.com/users/spectras","html_url":"https://github.com/spectras","followers_url":"https://api.github.com/users/spectras/followers","following_url":"https://api.github.com/users/spectras/following{/other_user}","gists_url":"https://api.github.com/users/spectras/gists{/gist_id}","starred_url":"https://api.github.com/users/spectras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spectras/subscriptions","organizations_url":"https://api.github.com/users/spectras/orgs","repos_url":"https://api.github.com/users/spectras/repos","events_url":"https://api.github.com/users/spectras/events{/privacy}","received_events_url":"https://api.github.com/users/spectras/received_events","type":"User","site_admin":false},"repo":{"id":14204652,"name":"django-hvad","full_name":"spectras/django-hvad","owner":{"login":"spectras","id":5879675,"avatar_url":"https://avatars.githubusercontent.com/u/5879675?v=2","gravatar_id":"","url":"https://api.github.com/users/spectras","html_url":"https://github.com/spectras","followers_url":"https://api.github.com/users/spectras/followers","following_url":"https://api.github.com/users/spectras/following{/other_user}","gists_url":"https://api.github.com/users/spectras/gists{/gist_id}","starred_url":"https://api.github.com/users/spectras/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spectras/subscriptions","organizations_url":"https://api.github.com/users/spectras/orgs","repos_url":"https://api.github.com/users/spectras/repos","events_url":"https://api.github.com/users/spectras/events{/privacy}","received_events_url":"https://api.github.com/users/spectras/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/spectras/django-hvad","description":"My pending pull requests, and a few additional features I use in my own project. Branch \"master\" tracks Kristian's. Branch \"nomadic\" tracks all features I use that did not make it into Kristian's (yet?)","fork":true,"url":"https://api.github.com/repos/spectras/django-hvad","forks_url":"https://api.github.com/repos/spectras/django-hvad/forks","keys_url":"https://api.github.com/repos/spectras/django-hvad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/spectras/django-hvad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/spectras/django-hvad/teams","hooks_url":"https://api.github.com/repos/spectras/django-hvad/hooks","issue_events_url":"https://api.github.com/repos/spectras/django-hvad/issues/events{/number}","events_url":"https://api.github.com/repos/spectras/django-hvad/events","assignees_url":"https://api.github.com/repos/spectras/django-hvad/assignees{/user}","branches_url":"https://api.github.com/repos/spectras/django-hvad/branches{/branch}","tags_url":"https://api.github.com/repos/spectras/django-hvad/tags","blobs_url":"https://api.github.com/repos/spectras/django-hvad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/spectras/django-hvad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/spectras/django-hvad/git/refs{/sha}","trees_url":"https://api.github.com/repos/spectras/django-hvad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/spectras/django-hvad/statuses/{sha}","languages_url":"https://api.github.com/repos/spectras/django-hvad/languages","stargazers_url":"https://api.github.com/repos/spectras/django-hvad/stargazers","contributors_url":"https://api.github.com/repos/spectras/django-hvad/contributors","subscribers_url":"https://api.github.com/repos/spectras/django-hvad/subscribers","subscription_url":"https://api.github.com/repos/spectras/django-hvad/subscription","commits_url":"https://api.github.com/repos/spectras/django-hvad/commits{/sha}","git_commits_url":"https://api.github.com/repos/spectras/django-hvad/git/commits{/sha}","comments_url":"https://api.github.com/repos/spectras/django-hvad/comments{/number}","issue_comment_url":"https://api.github.com/repos/spectras/django-hvad/issues/comments/{number}","contents_url":"https://api.github.com/repos/spectras/django-hvad/contents/{+path}","compare_url":"https://api.github.com/repos/spectras/django-hvad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/spectras/django-hvad/merges","archive_url":"https://api.github.com/repos/spectras/django-hvad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/spectras/django-hvad/downloads","issues_url":"https://api.github.com/repos/spectras/django-hvad/issues{/number}","pulls_url":"https://api.github.com/repos/spectras/django-hvad/pulls{/number}","milestones_url":"https://api.github.com/repos/spectras/django-hvad/milestones{/number}","notifications_url":"https://api.github.com/repos/spectras/django-hvad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/spectras/django-hvad/labels{/name}","releases_url":"https://api.github.com/repos/spectras/django-hvad/releases{/id}","created_at":"2013-11-07T13:39:20Z","updated_at":"2014-07-03T16:37:01Z","pushed_at":"2014-10-22T07:23:41Z","git_url":"git://github.com/spectras/django-hvad.git","ssh_url":"git@github.com:spectras/django-hvad.git","clone_url":"https://github.com/spectras/django-hvad.git","svn_url":"https://github.com/spectras/django-hvad","homepage":"https://github.com/KristianOellegaard/django-hvad","size":2888,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"KristianOellegaard:master","ref":"master","sha":"7d8891455a11a8d8b90e3357785fee4d9a68036a","user":{"login":"KristianOellegaard","id":235775,"avatar_url":"https://avatars.githubusercontent.com/u/235775?v=2","gravatar_id":"","url":"https://api.github.com/users/KristianOellegaard","html_url":"https://github.com/KristianOellegaard","followers_url":"https://api.github.com/users/KristianOellegaard/followers","following_url":"https://api.github.com/users/KristianOellegaard/following{/other_user}","gists_url":"https://api.github.com/users/KristianOellegaard/gists{/gist_id}","starred_url":"https://api.github.com/users/KristianOellegaard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KristianOellegaard/subscriptions","organizations_url":"https://api.github.com/users/KristianOellegaard/orgs","repos_url":"https://api.github.com/users/KristianOellegaard/repos","events_url":"https://api.github.com/users/KristianOellegaard/events{/privacy}","received_events_url":"https://api.github.com/users/KristianOellegaard/received_events","type":"User","site_admin":false},"repo":{"id":1576129,"name":"django-hvad","full_name":"KristianOellegaard/django-hvad","owner":{"login":"KristianOellegaard","id":235775,"avatar_url":"https://avatars.githubusercontent.com/u/235775?v=2","gravatar_id":"","url":"https://api.github.com/users/KristianOellegaard","html_url":"https://github.com/KristianOellegaard","followers_url":"https://api.github.com/users/KristianOellegaard/followers","following_url":"https://api.github.com/users/KristianOellegaard/following{/other_user}","gists_url":"https://api.github.com/users/KristianOellegaard/gists{/gist_id}","starred_url":"https://api.github.com/users/KristianOellegaard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KristianOellegaard/subscriptions","organizations_url":"https://api.github.com/users/KristianOellegaard/orgs","repos_url":"https://api.github.com/users/KristianOellegaard/repos","events_url":"https://api.github.com/users/KristianOellegaard/events{/privacy}","received_events_url":"https://api.github.com/users/KristianOellegaard/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KristianOellegaard/django-hvad","description":"Painless translations in django, using the regular ORM. Integrates easily into existing projects and apps. Easy convertible from django-multilingual-ng.","fork":false,"url":"https://api.github.com/repos/KristianOellegaard/django-hvad","forks_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/forks","keys_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/teams","hooks_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/hooks","issue_events_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/issues/events{/number}","events_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/events","assignees_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/assignees{/user}","branches_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/branches{/branch}","tags_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/tags","blobs_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/git/refs{/sha}","trees_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/statuses/{sha}","languages_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/languages","stargazers_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/stargazers","contributors_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/contributors","subscribers_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/subscribers","subscription_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/subscription","commits_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/commits{/sha}","git_commits_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/git/commits{/sha}","comments_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/comments{/number}","issue_comment_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/issues/comments/{number}","contents_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/contents/{+path}","compare_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/merges","archive_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/downloads","issues_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/issues{/number}","pulls_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls{/number}","milestones_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/milestones{/number}","notifications_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/labels{/name}","releases_url":"https://api.github.com/repos/KristianOellegaard/django-hvad/releases{/id}","created_at":"2011-04-06T07:52:52Z","updated_at":"2014-10-20T17:17:43Z","pushed_at":"2014-10-17T12:04:48Z","git_url":"git://github.com/KristianOellegaard/django-hvad.git","ssh_url":"git@github.com:KristianOellegaard/django-hvad.git","clone_url":"https://github.com/KristianOellegaard/django-hvad.git","svn_url":"https://github.com/KristianOellegaard/django-hvad","homepage":"https://github.com/KristianOellegaard/django-hvad","size":3043,"stargazers_count":247,"watchers_count":247,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":76,"mirror_url":null,"open_issues_count":9,"forks":76,"open_issues":9,"watchers":247,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/206"},"html":{"href":"https://github.com/KristianOellegaard/django-hvad/pull/206"},"issue":{"href":"https://api.github.com/repos/KristianOellegaard/django-hvad/issues/206"},"comments":{"href":"https://api.github.com/repos/KristianOellegaard/django-hvad/issues/206/comments"},"review_comments":{"href":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/206/comments"},"review_comment":{"href":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/KristianOellegaard/django-hvad/pulls/206/commits"},"statuses":{"href":"https://api.github.com/repos/KristianOellegaard/django-hvad/statuses/121fa636f1e2cf38b57579db2254bb0e76a8b339"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":1,"review_comments":0,"commits":1,"additions":30,"deletions":2,"changed_files":3}}