def spotting_view(request): result = '' if request.method == 'POST': json_data = simplejson.loads(request.raw_post_data) s_celebrity_key = json_data['celebrity_id'] s_celebrity_name = json_data['celebrity_name'] s_location_id = json_data['location_4sqid'] s_location_name = json_data['location_name'] s_comment = json_data['comment'] s_stalker_key = json_data['user_id'] if s_celebrity_key is None or len(s_celebrity_key) == 0 : celebrities = Celebrity.all().filter('name', s_celebrity_name).fetch(1) celebrity = None if len(celebrities) == 0: celebrity = Celebrity(name=s_celebrity_name) celebrity.put() else: celebrity = celebrities[0] new_spotting = Spotting(celebrity=celebrity.key(), stalker=db.Key(s_stalker_key), location=s_location_id, location_name=s_location_name, comment=s_comment) new_spotting.put() result = {'spotting':str(new_spotting.key()), 'celebrity_id':str(celebrity.key())} else: new_spotting = Spotting(celebrity=db.Key(s_celebrity_key), stalker=db.Key(s_stalker_key), location=s_location_id, location_name=s_location_name, comment=s_comment) new_spotting.put() result = {'spotting':str(new_spotting.key()), 'celebrity_id':str(celebrity.key())} return HttpResponse(simplejson.dumps(result), mimetype="text/json")
def spotting_view(request): result = '' if request.method == 'POST': json_data = simplejson.loads(request.raw_post_data) s_celebrity_key = json_data['celebrity_id'] s_celebrity_name = json_data['celebrity_name'] s_location_id = json_data['location_4sqid'] s_location_name = json_data['location_name'] s_comment = json_data['comment'] s_stalker_key = json_data['user_id'] if s_celebrity_key is None or len(s_celebrity_key) == 0: celebrities = Celebrity.all().filter('name', s_celebrity_name).fetch(1) celebrity = None if len(celebrities) == 0: celebrity = Celebrity(name=s_celebrity_name) celebrity.put() else: celebrity = celebrities[0] new_spotting = Spotting(celebrity=celebrity.key(), stalker=db.Key(s_stalker_key), location=s_location_id, location_name=s_location_name, comment=s_comment) new_spotting.put() result = { 'spotting': str(new_spotting.key()), 'celebrity_id': str(celebrity.key()) } else: new_spotting = Spotting(celebrity=db.Key(s_celebrity_key), stalker=db.Key(s_stalker_key), location=s_location_id, location_name=s_location_name, comment=s_comment) new_spotting.put() result = { 'spotting': str(new_spotting.key()), 'celebrity_id': str(celebrity.key()) } return HttpResponse(simplejson.dumps(result), mimetype="text/json")
def build_test_view(request): celebrity1 = Celebrity(name='Albert Au') celebrity1.put() celebrity1 = Celebrity(name='Kenny Bee') celebrity1.put() celebrity1 = Celebrity(name='Danny Chan') celebrity1.put() celebrity1 = Celebrity(name='Daniel Chan') celebrity1.put() celebrity1 = Celebrity(name='Eason Chan') celebrity1.put() celebrity1 = Celebrity(name='Jackie Chan') celebrity1.put() celebrity1 = Celebrity(name='Jaycee Chan') celebrity1.put() celebrity1 = Celebrity(name='Jordan Chan') celebrity1.put() celebrity1 = Celebrity(name='Jason Chan') celebrity1.put() celebrity1 = Celebrity(name='Sammul Chan') celebrity1.put() celebrity1 = Celebrity(name='William Chan') celebrity1.put() celebrity1 = Celebrity(name='Pak Ho Chau') celebrity1.put() celebrity1 = Celebrity(name='Wakin (Emil) Chau') celebrity1.put() celebrity1 = Celebrity(name='Edison Chen') celebrity1.put() celebrity1 = Celebrity(name='Adam Cheng') celebrity1.put() celebrity1 = Celebrity(name='Ekin Cheng') celebrity1.put() celebrity1 = Celebrity(name='Kevin Cheng') celebrity1.put() celebrity1 = Celebrity(name='Ronald Cheng') celebrity1.put() celebrity1 = Celebrity(name='Hins Cheung') celebrity1.put() celebrity1 = Celebrity(name='Julian Cheung') celebrity1.put() celebrity1 = Celebrity(name='Ryan Lau') celebrity1.put() celebrity1 = Celebrity(name='Alfred Hui') celebrity1.put() celebrity1 = Celebrity(name='Jacky Cheung') celebrity1.put() celebrity1 = Celebrity(name='Leslie Cheung') celebrity1.put() celebrity1 = Celebrity(name='Louis Koo') celebrity1.put() celebrity1 = Celebrity(name='Louis Cheung') celebrity1.put() celebrity1 = Celebrity(name='Steven Cheung') celebrity1.put() celebrity1 = Celebrity(name='Benji Chiang') celebrity1.put() celebrity1 = Celebrity(name='Endy Chow') celebrity1.put() celebrity1 = Celebrity(name='Alex Fong') celebrity1.put() celebrity1 = Celebrity(name='Khalil Fong') celebrity1.put() celebrity1 = Celebrity(name='Andy Hui') celebrity1.put() celebrity1 = Celebrity(name='Ken Hung') celebrity1.put() celebrity1 = Celebrity(name='Kelvin Kwan') celebrity1.put() celebrity1 = Celebrity(name='Kenny Kwan') celebrity1.put() celebrity1 = Celebrity(name='Michael Kwan') celebrity1.put() celebrity1 = Celebrity(name='Leo Ku') celebrity1.put() celebrity1 = Celebrity(name='Aaron Kwok') celebrity1.put() celebrity1 = Celebrity(name='Roger Kwok') celebrity1.put() celebrity1 = Celebrity(name='Leon Lai') celebrity1.put() celebrity1 = Celebrity(name='Bowie Lam') celebrity1.put() celebrity1 = Celebrity(name='Chet Lam') celebrity1.put() celebrity1 = Celebrity(name='George Lam') celebrity1.put() celebrity1 = Celebrity(name='Raymond Lam') celebrity1.put() celebrity1 = Celebrity(name='Jan Lamb') celebrity1.put() celebrity1 = Celebrity(name='Andy Lau') celebrity1.put() celebrity1 = Celebrity(name='Wilfred Lau') celebrity1.put() celebrity1 = Celebrity(name='Gene Lee') celebrity1.put() celebrity1 = Celebrity(name='Hacken Lee') celebrity1.put() celebrity1 = Celebrity(name='Edmond Leung') celebrity1.put() celebrity1 = Celebrity(name='Tony Leung') celebrity1.put() celebrity1 = Celebrity(name='Don Li') celebrity1.put() celebrity1 = Celebrity(name='Gallen Lo') celebrity1.put() celebrity1 = Celebrity(name='Justin Lo') celebrity1.put() celebrity1 = Celebrity(name='Lowell Lo') celebrity1.put() celebrity1 = Celebrity(name='Douglas Low') celebrity1.put() celebrity1 = Celebrity(name='Juno Mak') celebrity1.put() celebrity1 = Celebrity(name='Dennis Mak') celebrity1.put() celebrity1 = Celebrity(name='Pong Nan') celebrity1.put() celebrity1 = Celebrity(name='Deep Ng') celebrity1.put() celebrity1 = Celebrity(name='Ron Ng') celebrity1.put() celebrity1 = Celebrity(name='Edwin Siu') celebrity1.put() celebrity1 = Celebrity(name='William So') celebrity1.put() celebrity1 = Celebrity(name='Alan Tam') celebrity1.put() celebrity1 = Celebrity(name='Roman Tam') celebrity1.put() celebrity1 = Celebrity(name='Patrick Tang') celebrity1.put() celebrity1 = Celebrity(name='Alex To') celebrity1.put() celebrity1 = Celebrity(name='Nicholas Tse') celebrity1.put() celebrity1 = Celebrity(name='Wong Cho Lam') celebrity1.put() celebrity1 = Celebrity(name='Deric Wan') celebrity1.put() celebrity1 = Celebrity(name='Dave Wang') celebrity1.put() celebrity1 = Celebrity(name='Philip Wei Xiong') celebrity1.put() celebrity1 = Celebrity(name='Chris Wong') celebrity1.put() celebrity1 = Celebrity(name='Paul Wong') celebrity1.put() celebrity1 = Celebrity(name='Bosco Wong') celebrity1.put() celebrity1 = Celebrity(name='Anthony Wong') celebrity1.put() celebrity1 = Celebrity(name='James Wong') celebrity1.put() celebrity1 = Celebrity(name='Charles Ying') celebrity1.put() celebrity1 = Celebrity(name='Shawn Yue') celebrity1.put() celebrity1 = Celebrity(name='Samuel Hui') celebrity1.put() celebrity1 = Celebrity(name='Yip Sai Wing') celebrity1.put() celebrity1 = Celebrity(name='MC Jin') celebrity1.put() celebrity1 = Celebrity(name='Bobo Chan') celebrity1.put() celebrity1 = Celebrity(name='Connie Chan') celebrity1.put() celebrity1 = Celebrity(name='Chelsia Chan') celebrity1.put() celebrity1 = Celebrity(name='Flora Chan') celebrity1.put() celebrity1 = Celebrity(name='Kit Chan') celebrity1.put() celebrity1 = Celebrity(name='Priscilla Chan') celebrity1.put() celebrity1 = Celebrity(name='Vincy Chan') celebrity1.put() celebrity1 = Celebrity(name='Kelly Chen') celebrity1.put() celebrity1 = Celebrity(name='Joyce Cheng') celebrity1.put() celebrity1 = Celebrity(name='Sammi Cheng') celebrity1.put() celebrity1 = Celebrity(name='Stephanie Cheng') celebrity1.put() celebrity1 = Celebrity(name='Yumiko Cheng') celebrity1.put() celebrity1 = Celebrity(name='Cecilia Cheung') celebrity1.put() celebrity1 = Celebrity(name='Teresa Cheung') celebrity1.put() celebrity1 = Celebrity(name='Lesley Chiang') celebrity1.put() celebrity1 = Celebrity(name='Mandy Chiang') celebrity1.put() celebrity1 = Celebrity(name='Maggie Fu') celebrity1.put() celebrity1 = Celebrity(name='Charlene Choi') celebrity1.put() celebrity1 = Celebrity(name='Gillian Chung') celebrity1.put() celebrity1 = Celebrity(name='Rachelle Chung') celebrity1.put() celebrity1 = Celebrity(name='Sherman Chung') celebrity1.put() celebrity1 = Celebrity(name='Linda Chung') celebrity1.put() celebrity1 = Celebrity(name='Niki Chow') celebrity1.put() celebrity1 = Celebrity(name='Vivian Chow') celebrity1.put() celebrity1 = Celebrity(name='Renee Dai') celebrity1.put() celebrity1 = Celebrity(name='Theresa Fu') celebrity1.put() celebrity1 = Celebrity(name='Fiona Fung') celebrity1.put() celebrity1 = Celebrity(name='G.E.M.') celebrity1.put() celebrity1 = Celebrity(name='Cherry Ho') celebrity1.put() celebrity1 = Celebrity(name='Denise Ho') celebrity1.put() celebrity1 = Celebrity(name='Paisley Hu') celebrity1.put() celebrity1 = Celebrity(name='Deanie Ip') celebrity1.put() celebrity1 = Celebrity(name='Grace Ip') celebrity1.put() celebrity1 = Celebrity(name='Elanne Kong') celebrity1.put() celebrity1 = Celebrity(name='Ella Koon') celebrity1.put() celebrity1 = Celebrity(name='Kellyjackie') celebrity1.put() celebrity1 = Celebrity(name='Jade Kwan') celebrity1.put() celebrity1 = Celebrity(name='Shirley Kwan') celebrity1.put() celebrity1 = Celebrity(name='Susanna Kwan') celebrity1.put() celebrity1 = Celebrity(name='Gigi Lai') celebrity1.put() celebrity1 = Celebrity(name='Vivian Lai') celebrity1.put() celebrity1 = Celebrity(name='Mag Lam') celebrity1.put() celebrity1 = Celebrity(name='Sandy Lam') celebrity1.put() celebrity1 = Celebrity(name='Winnie Lau') celebrity1.put() celebrity1 = Celebrity(name='Coco Lee') celebrity1.put() celebrity1 = Celebrity(name='Annabelle Louie') celebrity1.put() celebrity1 = Celebrity(name='Eunix Lee') celebrity1.put() celebrity1 = Celebrity(name='Tiffany Lee') celebrity1.put() celebrity1 = Celebrity(name='Isabella Leong') celebrity1.put() celebrity1 = Celebrity(name='Cathy Leung') celebrity1.put() celebrity1 = Celebrity(name='Gigi Leung') celebrity1.put() celebrity1 = Celebrity(name='Toby Leung') celebrity1.put() celebrity1 = Celebrity(name='Rain Li') celebrity1.put() celebrity1 = Celebrity(name='Prudence Liew') celebrity1.put() celebrity1 = Celebrity(name='Candy Lo') celebrity1.put() celebrity1 = Celebrity(name='Mimi Lo') celebrity1.put() celebrity1 = Celebrity(name='Karen Morris') celebrity1.put() celebrity1 = Celebrity(name='Anita Mui') celebrity1.put() celebrity1 = Celebrity(name='Kary Ng') celebrity1.put() celebrity1 = Celebrity(name='Yan Ng') celebrity1.put() celebrity1 = Celebrity(name='Cass Phang') celebrity1.put() celebrity1 = Celebrity(name='Fiona Sit') celebrity1.put() celebrity1 = Celebrity(name='June Tang') celebrity1.put() celebrity1 = Celebrity(name='Stephy Tang') celebrity1.put() celebrity1 = Celebrity(name='Vangie Tang') celebrity1.put() celebrity1 = Celebrity(name='Teresa Teng') celebrity1.put() celebrity1 = Celebrity(name='Kay Tse') celebrity1.put() celebrity1 = Celebrity(name='Jenny Tseng') celebrity1.put() celebrity1 = Celebrity(name='Jessica Hsuan') celebrity1.put() celebrity1 = Celebrity(name='Kate Tsui') celebrity1.put() celebrity1 = Celebrity(name='Paula Tsui') celebrity1.put() celebrity1 = Celebrity(name='Janice Vidal') celebrity1.put() celebrity1 = Celebrity(name='Jill Vidal') celebrity1.put() celebrity1 = Celebrity(name='Liza Wang') celebrity1.put() celebrity1 = Celebrity(name='Emme Wong') celebrity1.put() celebrity1 = Celebrity(name='Faye Wong') celebrity1.put() celebrity1 = Celebrity(name='Ivana Wong') celebrity1.put() celebrity1 = Celebrity(name='Linda Wong') celebrity1.put() celebrity1 = Celebrity(name='Bianca Wu') celebrity1.put() celebrity1 = Celebrity(name='Myolie Wu') celebrity1.put() celebrity1 = Celebrity(name='Sally Yeh') celebrity1.put() celebrity1 = Celebrity(name='Charlie Yeung') celebrity1.put() celebrity1 = Celebrity(name='Miriam Yeung') celebrity1.put() celebrity1 = Celebrity(name='Frances Yip') celebrity1.put() celebrity1 = Celebrity(name='Veronica Yip') celebrity1.put() celebrity1 = Celebrity(name='Joey Yung') celebrity1.put() celebrity1 = Celebrity(name='Ivana Wong') celebrity1.put() celebrity1 = Celebrity(name='AMA Huen Ning') celebrity1.put() stalker = Stalker(email='*****@*****.**', password='******') stalker.put() celebrity1 = Celebrity(name='Jackie Chan') celebrity1.put() celebrity2 = Celebrity(name='Angelina Jolie') celebrity2.put() subscription = Subscription(stalker=stalker.key(), celebrity=celebrity1.key()) subscription.put() spotting1 = Spotting(celebrity=celebrity1.key(), stalker=stalker.key(), location='4fbf445de4b027be747589de', location_name='CoCoon (Coworking Space)', comment='Comment1') spotting1.put() spotting2 = Spotting(celebrity=celebrity1.key(), stalker=stalker.key(), location='4fbf445de4b027be747589de', location_name='CoCoon (Coworking Space)', comment='Comment2') spotting2.put() return HttpResponseServerError()