category getter, will need caching
This commit is contained in:
Родитель
ea441da562
Коммит
d9ed6532b0
|
@ -373,6 +373,9 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
|
||||||
def reviews(self):
|
def reviews(self):
|
||||||
return Review.objects.filter(addon=self, reply_to=None)
|
return Review.objects.filter(addon=self, reply_to=None)
|
||||||
|
|
||||||
|
def get_category(self, app):
|
||||||
|
return self.categories.filter(application=app)[0]
|
||||||
|
|
||||||
def language_ascii(self):
|
def language_ascii(self):
|
||||||
return settings.LANGUAGES[translation.to_language(self.default_locale)]
|
return settings.LANGUAGES[translation.to_language(self.default_locale)]
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<h3>{{ addon.name }}</h3>
|
<h3>{{ addon.name }}</h3>
|
||||||
{% with categories = addon.categories.filter(application=APP.id) %}
|
<div class="category" class="more-info">{{ addon.get_category(APP.id) }}</div>
|
||||||
{% if categories %}
|
|
||||||
<div class="category" class="more-info">
|
|
||||||
{{ categories[0] }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
|
||||||
<div class="rating">★★★★★</div>
|
<div class="rating">★★★★★</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|
Загрузка…
Ссылка в новой задаче