def create_new_mp(mp): _mp = MP() _mp.id = create_uniq_id(mp) _mp.picture = _mp.id + ".jpg" _mp.an_id=mp["url_an"].split("/")[-1].split(".")[0] if mp["place_en_hemicycle"] : _mp.hemicycle_sit = mp["place_en_hemicycle"] _mp.active = True else: _mp.hemicycle_sit = 0 _mp.active = False update_personal_informations(_mp, mp) update_group_info(_mp, mp) get_department_and_circo(mp, _mp) _mp.save() #get_new_emails(mp, _mp) #_mp.save() print "MP created !" return _mp
def index(request): mps = MP.view('mps/all') context = { 'mps': mps, } return direct_to_template(request, 'mps/index.html', context)
def detail(request, mp_id): mps = MP.view('mps/by_id', key=mp_id) context = { 'mp': mps.first(), } return direct_to_template(request, 'mps/detail.html', context)