{"action":"created","issue":{"url":"https://api.github.com/repos/mixxorz/behave-django/issues/12","labels_url":"https://api.github.com/repos/mixxorz/behave-django/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/mixxorz/behave-django/issues/12/comments","events_url":"https://api.github.com/repos/mixxorz/behave-django/issues/12/events","html_url":"https://github.com/mixxorz/behave-django/pull/12","id":82205460,"number":12,"title":"Add get_url() with built-in reverse() to context","user":{"login":"bittner","id":665072,"avatar_url":"https://avatars.githubusercontent.com/u/665072?v=3","gravatar_id":"","url":"https://api.github.com/users/bittner","html_url":"https://github.com/bittner","followers_url":"https://api.github.com/users/bittner/followers","following_url":"https://api.github.com/users/bittner/following{/other_user}","gists_url":"https://api.github.com/users/bittner/gists{/gist_id}","starred_url":"https://api.github.com/users/bittner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bittner/subscriptions","organizations_url":"https://api.github.com/users/bittner/orgs","repos_url":"https://api.github.com/users/bittner/repos","events_url":"https://api.github.com/users/bittner/events{/privacy}","received_events_url":"https://api.github.com/users/bittner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-29T01:35:23Z","updated_at":"2015-05-31T05:57:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/mixxorz/behave-django/pulls/12","html_url":"https://github.com/mixxorz/behave-django/pull/12","diff_url":"https://github.com/mixxorz/behave-django/pull/12.diff","patch_url":"https://github.com/mixxorz/behave-django/pull/12.patch"},"body":"Resolves issue #10 \r\n\r\nAs discussed. For developers stopping for more than 10 ms when hitting `base_url + reverse('foo:bar')`, and only 8 ms when hitting `get_url(reverse('foo:bar'))`.  :grimacing:\r\n\r\nAnd then there are those managers that worry about constructs that break more easily. Visually. Yes, it's about readability. Not nuclear physics.  :weary:\r\n\r\n## New coding style possible\r\n\r\nAs documented in the docstring, alternative choices to `context.base_url` are now:\r\n``` python\r\ncontext.get_url()  # alias for context.base_url\r\ncontext.get_url('/path/to/page/')\r\ncontext.get_url(reverse='resource-name')  # shortcut, requires no \"from ... import reverse\"\r\ncontext.get_url(reverse('resource-name'))\r\ncontext.get_url(reverse('resource-name', 'args', and='kwargs'))\r\n```\r\nI would add this as a reference to the Wiki documentation as soon as the PR is merged."},"comment":{"url":"https://api.github.com/repos/mixxorz/behave-django/issues/comments/107131399","html_url":"https://github.com/mixxorz/behave-django/pull/12#issuecomment-107131399","issue_url":"https://api.github.com/repos/mixxorz/behave-django/issues/12","id":107131399,"user":{"login":"mixxorz","id":3102758,"avatar_url":"https://avatars.githubusercontent.com/u/3102758?v=3","gravatar_id":"","url":"https://api.github.com/users/mixxorz","html_url":"https://github.com/mixxorz","followers_url":"https://api.github.com/users/mixxorz/followers","following_url":"https://api.github.com/users/mixxorz/following{/other_user}","gists_url":"https://api.github.com/users/mixxorz/gists{/gist_id}","starred_url":"https://api.github.com/users/mixxorz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mixxorz/subscriptions","organizations_url":"https://api.github.com/users/mixxorz/orgs","repos_url":"https://api.github.com/users/mixxorz/repos","events_url":"https://api.github.com/users/mixxorz/events{/privacy}","received_events_url":"https://api.github.com/users/mixxorz/received_events","type":"User","site_admin":false},"created_at":"2015-05-31T05:57:38Z","updated_at":"2015-05-31T05:57:38Z","body":"I actually don't know why this failed CI. Bad luck? Haha.\r\n\r\nAfter a few nights of reflecting, I think this is a welcome addition to behave-django. Although I think it could be better. Django's `redirect` shortcut function can accept a model instance, a view name (which will be passed to `reverse`), or an absolute or relative URL. I think we can use `django.shortcuts.resolve_url`](https://docs.djangoproject.com/en/1.8/_modules/django/shortcuts/) (the same function `redirect` uses) to mimic this behavior."}}