def update_user_education_info(self, education_json):
        try:
            location = MasterLocationModelHandler().insert(
                location_name=education_json["location"])
            university = MasterUniversityModelHandler().insert(
                university_name=education_json["university"])
            education_type = MasterEducationTypeModelHandler().insert(
                education_type=education_json["education_type"])

            updated_education_info = EducationInfoModelHandler().update(
                id=education_json["id"],
                user=self.current_user,
                university=university,
                location=location,
                education_type=education_type,
                start_date=education_json["start_date"],
                end_date=education_json["end_date"])

            data = EducationInfoSerializer(updated_education_info).data
            json_data = JSONRenderer().render(data)
            return json_data
        except Exception as ex:
            return json.dumps({
                "Error":
                "Not able to update the education : %s" % (ex.message)
            })
    def add_user_location_info(self, location_json):
        try:
            location = MasterLocationModelHandler().insert(
                location_name=location_json["location"])
            created_location_info = LocationInfoModelHandler().insert(
                user=self.current_user,
                location=location,
                when_start_date=location_json["when_start_date"],
                when_end_date=location_json["when_end_date"])

            data = LocationInfoSerializer(created_location_info).data
            json_data = JSONRenderer().render(data)
            return json_data
        except Exception as ex:
            return json.dumps(
                {"Error": "Not able to add the location : %s" % (ex.message)})
    def add_user_project_info(self, project_json):
        try:
            location = MasterLocationModelHandler().insert(
                location_name=project_json["location"])
            project = MasterProjectModelHandler().insert(
                project_name=project_json["project"])

            created_project_info = ProjectInfoModelHandler().insert(
                user=self.current_user,
                project=project,
                location=location,
                start_date=project_json["start_date"],
                end_date=project_json["end_date"])

            data = ProjectInfoSerializer(created_project_info).data
            json_data = JSONRenderer().render(data)
            return json_data
        except Exception as ex:
            return json.dumps(
                {"Error": "Not able to add the project : %s" % (ex.message)})
    def add_user_work_info(self, work_json):
        try:
            company = MasterCompanyModelHandler().insert(
                company_name=work_json["company"])
            location = MasterLocationModelHandler().insert(
                location_name=work_json["location"])
            designation = MasterDesignationModelHandler().insert(
                designation_name=work_json["designation"])

            created_work_info = WorkInfoModelHandler().insert(
                user=self.current_user,
                company=company,
                location=location,
                designation=designation,
                start_date=work_json["start_date"],
                end_date=work_json["end_date"])

            data = WorkInfoSerializer(created_work_info).data
            json_data = JSONRenderer().render(data)
            return json_data
        except Exception as ex:
            return json.dumps(
                {"Error": "Not able to add the work : %s" % (ex.message)})
 def get_location_list(self):
     queryset = MasterLocationModelHandler().find_all()
     data = MasterLocationSerializer(queryset, many=True).data
     json_data = JSONRenderer().render(data)
     return json_data