コード例 #1
0
ファイル: views.py プロジェクト: kpx13/webgenesis
def portfolio_page(request, curr_work=None):
    c = get_common_context(request)
    if curr_work:
        c['curr_work'] = Work.get_by_slug(curr_work)
        return render_to_response('portfolio_work.html', c, context_instance=RequestContext(request))
    else:
        c['tags'] = WorkTag.get_work_tags()
        c['works'] = Work.objects.all()
        return render_to_response('portfolio.html', c, context_instance=RequestContext(request))
コード例 #2
0
ファイル: views.py プロジェクト: wd5/webgenesis
def portfolio_page(request, curr_cat=None, curr_work=None):
    c = get_common_context(request)
    c['categories'] = Category.get_not_empty()
    c['curr_cat'] = Category.get_by_slug(curr_cat)
    if c['curr_cat'] is None:
        c['curr_cat'] = c['categories'][0]
    c['curr_work'] = Work.get_by_slug(curr_work)
    if c['curr_work'] is None:
        c['curr_work'] = Work.get_first_in_category(c['curr_cat'])
    return render_to_response('portfolio.html', c, context_instance=RequestContext(request))