{"action":"created","issue":{"url":"https://api.github.com/repos/infoportugal/wagtail-modeltranslation/issues/13","labels_url":"https://api.github.com/repos/infoportugal/wagtail-modeltranslation/issues/13/labels{/name}","comments_url":"https://api.github.com/repos/infoportugal/wagtail-modeltranslation/issues/13/comments","events_url":"https://api.github.com/repos/infoportugal/wagtail-modeltranslation/issues/13/events","html_url":"https://github.com/infoportugal/wagtail-modeltranslation/issues/13","id":94271239,"number":13,"title":"change_lang returns None","user":{"login":"ArieVanE","id":5507851,"avatar_url":"https://avatars.githubusercontent.com/u/5507851?v=3","gravatar_id":"","url":"https://api.github.com/users/ArieVanE","html_url":"https://github.com/ArieVanE","followers_url":"https://api.github.com/users/ArieVanE/followers","following_url":"https://api.github.com/users/ArieVanE/following{/other_user}","gists_url":"https://api.github.com/users/ArieVanE/gists{/gist_id}","starred_url":"https://api.github.com/users/ArieVanE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArieVanE/subscriptions","organizations_url":"https://api.github.com/users/ArieVanE/orgs","repos_url":"https://api.github.com/users/ArieVanE/repos","events_url":"https://api.github.com/users/ArieVanE/events{/privacy}","received_events_url":"https://api.github.com/users/ArieVanE/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-10T10:06:42Z","updated_at":"2015-08-08T00:15:23Z","closed_at":null,"body":"I'm using the wagtail demo and I have made the HomePage translatable according your instructions. In the admin this works fine.\r\n\r\nNow I amended the home_page.html template with this:\r\n\r\n    {% load modeltranslation %}\r\n    <li class=\"dropdown\">\r\n        <a data-toggle=\"dropdown\" class=\"dropdown-toggle\" data-hover=\"dropdown\" href=\"#\">{{     LANGUAGE_CODE }}<i class=\"fa fa-angle-down ml5\"></i></a>\r\n        <ul class=\"dropdown-menu\" id=\"language-dropdown\">\r\n            {% for lang in languages %}\r\n                {% if lang.0 != LANGUAGE_CODE %}\r\n                    <li tabindex=\"-1\"><a href=\"{% change_lang lang.0 %}\">{{ lang.1 }}</a></li>\r\n                {% endif %}\r\n            {% endfor %}\r\n       </ul>\r\n    </li>\r\n\r\nTo make sure that languages has a value I wrote a tiny context processor:\r\n\r\n    from django.conf import settings\r\n\r\n    def languages(request):\r\n\r\n        return {'languages': settings.LANGUAGES}\r\n\r\nAnd settings.LANGUAGES is defined like this (in compliance with the instructions from django-model-translation):\r\n    gettext = lambda s: s\r\n    LANGUAGES = (\r\n        ('en', gettext('English')),\r\n        ('nl', gettext('Dutch')),\r\n        ('bg', gettext('Bulgarian')),\r\n   ) \r\n\r\nUnfortunately this doesn't seem the way to do it, because the returned urls are None, for example:\r\n\r\n    <li tabindex=\"-1\"><a href=\"None\">Dutch</a></li>\r\n    <li tabindex=\"-1\"><a href=\"None\">Bulgarian</a></li>\r\n\r\nWhat am I doing wrong?"},"comment":{"url":"https://api.github.com/repos/infoportugal/wagtail-modeltranslation/issues/comments/128866254","html_url":"https://github.com/infoportugal/wagtail-modeltranslation/issues/13#issuecomment-128866254","issue_url":"https://api.github.com/repos/infoportugal/wagtail-modeltranslation/issues/13","id":128866254,"user":{"login":"pymarco","id":4700618,"avatar_url":"https://avatars.githubusercontent.com/u/4700618?v=3","gravatar_id":"","url":"https://api.github.com/users/pymarco","html_url":"https://github.com/pymarco","followers_url":"https://api.github.com/users/pymarco/followers","following_url":"https://api.github.com/users/pymarco/following{/other_user}","gists_url":"https://api.github.com/users/pymarco/gists{/gist_id}","starred_url":"https://api.github.com/users/pymarco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pymarco/subscriptions","organizations_url":"https://api.github.com/users/pymarco/orgs","repos_url":"https://api.github.com/users/pymarco/repos","events_url":"https://api.github.com/users/pymarco/events{/privacy}","received_events_url":"https://api.github.com/users/pymarco/received_events","type":"User","site_admin":false},"created_at":"2015-08-08T00:15:23Z","updated_at":"2015-08-08T00:15:23Z","body":"ArieVanE, your context processor is unneeded. In your template you can use\r\n\r\n```\r\n{% load i18n %}\r\n{% get_available_languages as LANGUAGES %}\r\n{% get_current_language as LANGUAGE_CODE %}\r\n```\r\n\r\nBut how to switch languages as you are trying to do is something I am yet to learn. Hopefully soon though"}}