~bnrubin/bantrackertwo/devel

« back to all changes in this revision

Viewing changes to bt/views.py

  • Committer: Benjamin Rubin
  • Date: 2009-08-10 16:53:45 UTC
  • Revision ID: bnrubin@romulus-20090810165345-c6en6tdw7k6rydfh
- Comments now are part of the parent Event to make templating easier
- Began some basic template work

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# Create your views here
 
2
from django.contrib.auth.decorators import login_required
 
3
from django.contrib.auth import logout
2
4
from django.shortcuts import render_to_response
3
 
from ircTrack.bt.models import UserProfile
 
5
from django.http import HttpResponseRedirect
 
6
from ircTrack.bt.models import UserProfile,Ban,Event
 
7
 
 
8
 
 
9
@login_required(redirect_field_name='/openid/login/')
4
10
def index(request):
5
 
    profile = request.user.get_profile()
6
 
    return render_to_response('bt/UserProfile.html', { 
7
 
                'profile' : profile, 
 
11
    return render_to_response('bt/events.html', { 
 
12
                'profile' : request.user.get_profile(), 
8
13
                'user' : request.user,
9
14
                'openid' : request,
 
15
                'events' : Event.objects.order_by('?')[:50],
10
16
                })
 
17
 
 
18
 
 
19
def logout_view(request):
 
20
    logout(request)
 
21
    return HttpResponseRedirect('/')