Commit 5bccdb52 authored by Michal Čihař's avatar Michal Čihař

Return urls including site in get_absolute_url

This better fits to API where we want to expose URLs including site.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 0469c21a
......@@ -22,6 +22,7 @@ from __future__ import unicode_literals
import io
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.db.utils import OperationalError
from django.utils.encoding import python_2_unicode_compatible, force_text
......@@ -34,6 +35,7 @@ from translate.lang.data import languages
from weblate.lang import data
from weblate.trans.mixins import PercentMixin
from weblate.trans.site import get_site_url
from weblate.appsettings import SIMPLIFY_LANGUAGES
from weblate.logger import LOGGER
......@@ -445,11 +447,13 @@ class Language(models.Model, PercentMixin):
return _('Plural')
return _('Plural form %d') % idx
@models.permalink
def get_absolute_url(self):
return ('show_language', (), {
'lang': self.code
})
return get_site_url(
reverse(
'show_language',
kwargs={'lang': self.code}
)
)
def _get_percents(self):
'''
......
......@@ -24,6 +24,7 @@ import os
from django.core.urlresolvers import reverse
from weblate.trans.site import get_site_url
from weblate.logger import LOGGER
......@@ -100,9 +101,11 @@ class URLMixin(object):
name,
self._reverse_url_name()
)
return reverse(
urlname,
kwargs=self._reverse_url_kwargs()
return get_site_url(
reverse(
urlname,
kwargs=self._reverse_url_kwargs()
)
)
def get_absolute_url(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment