~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to pybb/views.py

  • Committer: Shevonar
  • Date: 2012-04-19 19:46:21 UTC
  • mto: This revision was merged to the branch mainline in revision 330.
  • Revision ID: infomh@anmaruco.de-20120419194621-lac98edodt220fux
Added new design for forums

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
             'last_posts': Post.objects.order_by('-created').select_related()[:pybb_settings.QUICK_POSTS_NUMBER],
32
32
             }
33
33
 
34
 
    cats = {}
35
 
    forums = {}
36
 
 
37
 
    for forum in Forum.objects.all().select_related():
38
 
        cat = cats.setdefault(forum.category.id,
39
 
            {'cat': forum.category, 'forums': []})
40
 
        cat['forums'].append(forum)
41
 
        forums[forum.id] = forum
42
 
 
43
 
    cmpdef = lambda a, b: cmp(a['cat'].position, b['cat'].position)
44
 
    cats = sorted(cats.values(), cmpdef)
 
34
    cats = Category.objects.all().select_related()
45
35
 
46
36
    return {'cats': cats,
47
37
            'quick': quick,