#import pprint
from django.http import HttpResponse
# from django.template import Context, loader
from django.shortcuts import render, render_to_response, get_object_or_404
#from django.http import Http404
from coin.members.models import Member


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

def infos(request, member_id):
    member = get_object_or_404(Member, pk=member_id)
    return render('members/infos.html', {'member':member})

def abos(request, member_id):
    return render_to_response('members/abo.html')

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

def change_password(request, member_id):
    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})
