comparison gpp/bio/views.py @ 259:75ea1a8be7f2

Fix some old import problems where I used 'from django.contrib import auth' instead of 'from django.contrib.auth.models import User'. Also some formatting changes while I was in there.
author Brian Neal <bgneal@gmail.com>
date Tue, 21 Sep 2010 23:49:05 +0000
parents 7ddd60164245
children 1ba2c6bf6eb7
comparison
equal deleted inserted replaced
258:f9a9b4014d5b 259:75ea1a8be7f2
3 """ 3 """
4 4
5 from django.shortcuts import render_to_response 5 from django.shortcuts import render_to_response
6 from django.shortcuts import get_object_or_404 6 from django.shortcuts import get_object_or_404
7 from django.template import RequestContext 7 from django.template import RequestContext
8 from django.contrib import auth
9 from django.contrib import messages 8 from django.contrib import messages
9 from django.contrib.auth.models import User
10 from django.http import HttpResponse 10 from django.http import HttpResponse
11 from django.http import HttpResponseBadRequest 11 from django.http import HttpResponseBadRequest
12 from django.http import HttpResponseRedirect 12 from django.http import HttpResponseRedirect
13 from django.http import Http404 13 from django.http import Http404
14 from django.core.paginator import InvalidPage 14 from django.core.paginator import InvalidPage
36 @login_required 36 @login_required
37 def member_list(request, type='user'): 37 def member_list(request, type='user'):
38 """ 38 """
39 This view displays the member list. Only active members are displayed. 39 This view displays the member list. Only active members are displayed.
40 """ 40 """
41 qs = auth.models.User.objects.filter(is_active=True) 41 qs = User.objects.filter(is_active=True)
42 if type == 'user': 42 if type == 'user':
43 qs = qs.order_by('username') 43 qs = qs.order_by('username')
44 else: 44 else:
45 qs = qs.order_by('date_joined') 45 qs = qs.order_by('date_joined')
46 num_members = qs.count() 46 num_members = qs.count()
89 ####################################################################### 89 #######################################################################
90 90
91 @login_required 91 @login_required
92 def view_profile(request, username): 92 def view_profile(request, username):
93 93
94 user = get_object_or_404(auth.models.User, username = username) 94 user = get_object_or_404(User, username=username)
95 if user == request.user: 95 if user == request.user:
96 return HttpResponseRedirect(reverse('bio.views.my_profile')) 96 return HttpResponseRedirect(reverse('bio.views.my_profile'))
97 97
98 profile = user.get_profile() 98 profile = user.get_profile()
99 hide_email = profile.hide_email 99 hide_email = profile.hide_email