bug 564970, using app support for language tools
This commit is contained in:
Родитель
5a0fefac35
Коммит
0aec5e91a5
|
@ -13,6 +13,7 @@ import amo.test_utils
|
|||
from amo.urlresolvers import reverse
|
||||
from amo.helpers import urlparams
|
||||
from addons.models import Addon, Category
|
||||
from addons.cron import _update_appsupport
|
||||
from browse import views
|
||||
from browse.views import locale_display_name
|
||||
from translations.query import order_by_translation
|
||||
|
@ -35,6 +36,8 @@ class TestLanguageTools(test_utils.TestCase):
|
|||
def setUp(self):
|
||||
super(TestLanguageTools, self).setUp()
|
||||
cache.clear()
|
||||
ids = Addon.objects.values_list('id', flat=True)
|
||||
_update_appsupport(ids)
|
||||
self.url = reverse('browse.language-tools')
|
||||
response = self.client.get(self.url, follow=True)
|
||||
self.locales = response.context['locales']
|
||||
|
|
|
@ -49,9 +49,8 @@ Locale = collections.namedtuple('Locale', 'locale display native dicts packs')
|
|||
# uniform with the other type listings.
|
||||
def language_tools(request, category=None):
|
||||
types = (amo.ADDON_DICT, amo.ADDON_LPAPP)
|
||||
q = (Addon.objects.public().exclude(target_locale='')
|
||||
.filter(type__in=types, target_locale__isnull=False))
|
||||
addons = [a for a in q.all() if request.APP in a.compatible_apps]
|
||||
addons = Addon.objects.public().filter(appsupport__app=request.APP.id, type__in=types,
|
||||
target_locale__isnull=False).exclude(target_locale='').all()
|
||||
|
||||
for addon in addons:
|
||||
locale = addon.target_locale.lower()
|
||||
|
|
Загрузка…
Ссылка в новой задаче