3
3
from django.contrib.auth import logout
4
4
from django.shortcuts import render_to_response
5
5
from django.http import HttpResponseRedirect
6
from ircTrack.bt.models import UserProfile,Ban,Event
6
from ircTrack.bt.models import UserProfile,Event,Issue,IssueForm
9
9
@login_required(redirect_field_name='/openid/login/')
10
def ban_index(request):
11
11
return render_to_response('bt/events.html', {
12
12
'profile' : request.user.get_profile(),
13
13
'user' : request.user,
14
14
'openid' : request,
15
'events' : Event.objects.order_by('?')[:50],
15
'events' : Event.objects.all()[:50],
18
@login_required(redirect_field_name='/openid/login/')
19
def issue_index(request):
20
return render_to_response('bt/issues.html', {
21
'profile' : request.user.get_profile(),
22
'user' : request.user,
24
'issues' : Issue.objects.all()[:50],
27
@login_required(redirect_field_name='/openid/login/')
28
def settings(request):
29
return render_to_response('bt/settings.html', {
30
'profile' : request.user.get_profile(),
31
'user' : request.user,
19
35
def logout_view(request):
21
37
return HttpResponseRedirect('/')
39
def issue_new(request):
40
if request.method == 'POST':
41
form = IssueForm(request.POST)
44
issue = form.save(commit=False)
45
issue.author = request.user
47
return HttpResponseRedirect('/issue/')
51
return render_to_response('bt/newissue.html', {