1
# Create your views here.
4
from django.core.urlresolvers import reverse
5
from django.contrib.auth.decorators import login_required
6
from django.contrib.auth.models import User
7
from django.shortcuts import render_to_response
8
from django.template import RequestContext
9
from django.http import HttpResponseRedirect
11
from forms import EditProfileForm
15
def view(request, user = None):
17
View the profile. Note that login is required here
18
to make sure that not all spam post can harvest here
21
profile = request.user.wlprofile
23
profile = User.objects.get( username = user ).wlprofile
29
return render_to_response("wlprofile/view_profile.html",
31
context_instance=RequestContext(request))
35
instance = request.user.wlprofile
37
if request.method == 'POST':
38
form = EditProfileForm(request.POST, instance=instance)
41
# We have to handle avatar
45
return HttpResponseRedirect(reverse(view))
46
form = EditProfileForm(instance=instance)
48
print "instance:", instance
53
return render_to_response("wlprofile/edit_profile.html",
55
context_instance=RequestContext(request))