#import pprint
from django.http import HttpResponse
from django.template import RequestContext

# from django.template import Context, loader
from django.shortcuts import render, render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
#from django.http import Http404
from coin.members.models import Member


@login_required
def index(request):
    return render_to_response('members/index.html')

@login_required
def infos(request):
    member = request.user.member
    return render_to_response('members/infos.html', {'member':member},
                              context_instance=RequestContext(request))

@login_required
def abos(request):
    return render_to_response('members/abo.html')

@login_required
def contact(request):
    return render_to_response('members/contact.html')

@login_required
def change_password(request):
    member = get_object_or_404(Member, pk=member_id)
    if request.POST['password']:
        member.password = ''
    else:
        return render(request, 'members/change_password.html',
                      {'member': member})
