Here is my view :
def GeneralUserPictureChange(request, pk, username):
thumb = GeneralUser.objects.get(pk=pk)
if thumb.username == request.user:
if request.method == 'POST':
form = GeneralUserPictureChangeForm(request.POST, request.FILES)
if form.is_valid():
thumb.thumbnail = form.cleaned_data['thumbnail']
thumb.save()
return redirect("user_profile", pk, username)
else:
return render_to_response("gnu_picture_change.html", {"form":form, "basic_info":thumb}, context_instance=RequestContext(request))
else:
form = GeneralUserPictureChangeForm()
return render_to_response("gnu_picture_change.html", {"form":form, "basic_info":thumb}, context_instance=RequestContext(request))
When I do this gives the error didnt return HttpResponse object. But when I remove the line
if thumb.username == request.user: and continue with proper indentation it dont gives the error..
Need help ...
if thumb.username == request.user:is true and the code goes in that direction?