Skip to content

Commit

Permalink
filtre les categories tuto avec au moins un tuto
Browse files Browse the repository at this point in the history
  • Loading branch information
dralliw committed Jun 12, 2014
1 parent 20ceef7 commit 1d6a0b5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions zds/utils/templatetags/topbar.py
Expand Up @@ -3,7 +3,7 @@
from django import template

from zds.forum.models import Category as fCategory
from zds.utils.models import Category as Category
from zds.utils.models import Category, SubCategory, CategorySubCategory


register = template.Library()
Expand Down Expand Up @@ -33,6 +33,10 @@ def auth_forum(forum, user):

@register.filter('top_categories_tuto')
def top_categories_tuto(user):
cats = []
categories = Category.objects.all()

return categories
for categorie in categories :
if categorie.get_tutos().count() > 0:
cats.append(categorie)

return cats

0 comments on commit 1d6a0b5

Please sign in to comment.