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):
|
||||
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):
|
||||
return settings.LANGUAGES[translation.to_language(self.default_locale)]
|
||||
|
||||
|
|
|
@ -9,13 +9,7 @@
|
|||
</div>
|
||||
<div class="summary">
|
||||
<h3>{{ addon.name }}</h3>
|
||||
{% with categories = addon.categories.filter(application=APP.id) %}
|
||||
{% if categories %}
|
||||
<div class="category" class="more-info">
|
||||
{{ categories[0] }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
<div class="category" class="more-info">{{ addon.get_category(APP.id) }}</div>
|
||||
<div class="rating">★★★★★</div>
|
||||
</div>
|
||||
</a>
|
||||
|
|
Загрузка…
Ссылка в новой задаче