equal
deleted
inserted
replaced
|
1 from datetime import datetime |
|
2 |
1 from django.contrib.auth.models import User |
3 from django.contrib.auth.models import User |
2 from django.contrib.auth import authenticate, login, logout |
4 from django.contrib.auth import authenticate, login, logout |
3 from django.contrib.auth.decorators import login_required |
5 from django.contrib.auth.decorators import login_required |
4 |
6 |
5 from django.shortcuts import render_to_response, redirect |
7 from django.shortcuts import render_to_response, redirect |
17 If not, only show the re send activation email link. |
19 If not, only show the re send activation email link. |
18 else show all the options in homepage. |
20 else show all the options in homepage. |
19 """ |
21 """ |
20 |
22 |
21 user = request.user |
23 user = request.user |
22 events = Event.objects.all()[:10] |
24 |
23 |
25 return render_to_response('index.html', {'user':user}) |
24 return render_to_response('index.html', {'user':user, 'events':events}) |
|
25 |
26 |
26 def user_login(request): |
27 def user_login(request): |
27 """ get the user object from e-mail and then check for password. |
28 """ get the user object from e-mail and then check for password. |
28 """ |
29 """ |
29 |
30 |
322 'interests': user_profile.interests, |
323 'interests': user_profile.interests, |
323 } |
324 } |
324 form = reg_forms.EditProfileForm(old_info) |
325 form = reg_forms.EditProfileForm(old_info) |
325 return render_to_response('edit_profile.html', {'user':user, 'form':form}) |
326 return render_to_response('edit_profile.html', {'user':user, 'form':form}) |
326 |
327 |
327 |
328 def list_events(request): |
|
329 """ Get all the events including those that are over and list them. |
|
330 """ |
|
331 |
|
332 user = request.user |
|
333 |
|
334 today = datetime.now() |
|
335 context = {'user':user, |
|
336 'upcoming_events': Event.objects.filter(start_date__gt=today), |
|
337 'ongoing_events': Event.objects.filter(start_date__lte=today, stop_date__gte=today), |
|
338 'previous_events': Event.objects.filter(stop_date__lt=today), |
|
339 } |
|
340 |
|
341 return render_to_response('list_events.html', context) |
|
342 |