def api_qualifications_all(): result = { "status": "success", "message": "Retrieved all qualifications successfully.", "object": Qualifications.get_all_qualifications() } return Response(dumps(result), 200, mimetype='application/json')
def serialize_without_roles(self): json_user = { "id": self.id, "userid": self.userid, "firstname": self.firstname, "middlename": self.middlename, "lastname": self.lastname, "fullname": self.fullname(), "fathername": self.fathername, "gender": self.gender, "nationality": self.nationality, "dob": self.dob.strftime("%d/%m/%Y"), "address": self.address, "pan": self.pan, "designation": self.designation, "ctc": self.ctc, "ectc": self.ectc, "teachingsubject": Subjects.get_subject_from_id(self.teachingsubject).subject, "district": Districts.get_district_from_id(self.district).district, "stateLocation": States.get_state_from_id(self.state).state, "town": Towns.get_town_from_id(self.town).town, "qualification": Qualifications.get_qualification_from_id( self.qualification).qualification, "totalexperience": self.totalexperience, "circulum": self.circulum, "teachingmedium": self.teachingmedium, "currentorganization": self.currentorganization, "segment": self.segment, "department": self.department } return json_user
def api_qualification_via_id(id): qualification = Qualifications.get_qualification_from_id(id) if qualification.id < 0: result = { "status": "failure", "message": "Failed to retrieve an Invalid qualification." } return Response(dumps(result), 400, mimetype='application/json') result = { "status": "success", "message": "Qualification retrieved successfully.", "qualification": qualification.serialize() } return Response(dumps(result), 200, mimetype='application/json')
def api_add_qualification(): request_data = request.get_json() qualification = Qualifications.submit_qualification_from_json(request_data) if qualification is None or qualification.id < 0: result = { "status": "failure", "message": "Failed to add an Invalid Qualification." } return Response(dumps(result), 500, mimetype='application/json') result = { "status": "success", "message": "Qualification added successfully.", "qualification": qualification.serialize() } return Response(dumps(result), 201, mimetype='application/json')
def api_qualifications(): if 'id' in request.args: id = int(request.args['id']) else: result = { "status": "failure", "message": "Failed to retrieve an Invalid Qualification, no (id) field provided. please specify an (id)." } return Response(dumps(result), 400, mimetype='application/json') qualification = Qualifications.get_qualification_from_id(id) result = { "status": "success", "message": "Qualification retrieved successfully.", "qualification": qualification.serialize() } return Response(dumps(result), 200, mimetype='application/json')
def serialize_view_userprofile(cls, userprofile_dict): json_user = { "id": userprofile_dict["id"], "userid": userprofile_dict["userid"], "firstname": userprofile_dict["firstname"], "middlename": userprofile_dict["middlename"], "lastname": userprofile_dict["lastname"], "fullname": userprofile_dict["firstname"] + ' ' + userprofile_dict["middlename"] + ' ' + userprofile_dict["lastname"], "fathername": userprofile_dict["fathername"], "gender": userprofile_dict["gender"], "nationality": userprofile_dict["nationality"], "dob": userprofile_dict["dob"].strftime("%d/%m/%Y"), "address": userprofile_dict["address"], "pan": userprofile_dict["pan"], "designation": userprofile_dict["designation"], "ctc": userprofile_dict["ctc"], "ectc": userprofile_dict["ectc"], "teachingsubject": Subjects.get_subject_from_id( userprofile_dict["teachingsubject"]).subject, "district": Districts.get_district_from_id( userprofile_dict["district"]).district, "stateLocation": States.get_state_from_id(userprofile_dict["state"]).state, "town": Towns.get_town_from_id(userprofile_dict["town"]).town, "qualification": Qualifications.get_qualification_from_id( userprofile_dict["qualification"]).qualification, "totalexperience": userprofile_dict["totalexperience"], "circulum": userprofile_dict["circulum"], "teachingmedium": userprofile_dict["teachingmedium"], "currentorganization": userprofile_dict["currentorganization"], "segment": userprofile_dict["segment"], "department": userprofile_dict["department"], "email": userprofile_dict["email"], "mobile": userprofile_dict["mobile"] } return json_user