def get(self, disciplinename): sub_coll = Lab.objects(discipline_name=disciplinename).to_json() if sub_coll: self.write(sub_coll) else: self.set_status(404) self.write({"error": "Details not found with specified discipline"})
def get(self): search = {} for field in self.request.arguments: search[field] = self.get_query_argument(field) print search labs = Lab.objects(__raw__=search) if len(labs): self.finish({'labs': map(lambda x: x.to_client(), labs)}) else: self.set_status(400) self.finish({'error': 'No lab found'})
def get(self, instt_name, disc_name=None): print 'incoming instt name' print instt_name labs = Lab.objects(institute_name=instt_name) if disc_name: print disc_name labs = labs.filter(discipline_name=disc_name) print labs if len(labs): self.finish({'labs': map(lambda x: x.to_client(), labs)}) else: self.set_status(404) self.finish({'error': 'Institute not found'})