~chipaca/unity-lens-video/custom-user-agent

« back to all changes in this revision

Viewing changes to main/views.py

  • Committer: Janos Gyerik
  • Date: 2011-08-07 18:41:19 UTC
  • Revision ID: janos@axiom-20110807184119-ot0y6o19cyxjh11q
added get_common_params and change nav links depending on user authenticated or not

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#
11
11
 
12
12
 
 
13
''' helper methods '''
 
14
 
 
15
def get_common_params(request):
 
16
    params = {
 
17
            'user': request.user,
 
18
            }
 
19
    return params
 
20
 
 
21
 
13
22
''' url handlers '''
14
23
 
15
24
def index(request):
16
 
    params = {
17
 
            'oneliners': OneLiner.objects.filter(is_published=True).order_by('-pk')
18
 
            }
 
25
    params = get_common_params(request)
 
26
    params['oneliners'] = OneLiner.objects.filter(is_published=True).order_by('-pk')
 
27
 
19
28
    return render_to_response('main/index.html', params)
20
29
 
21
30
def oneliner(request, pk):
22
31
    return index(request)
23
32
 
24
33
def rules(request):
25
 
    return render_to_response('main/rules.html')
 
34
    params = get_common_params(request)
 
35
 
 
36
    return render_to_response('main/rules.html', params)
26
37
 
27
38
 
28
39
# eof