def get_system_configuration_by_id(config_id): """Get a specific configuration using it's id""" type_name = load_system_configuration_type(ObjectId(config_id)) type = BaseSystemConfiguration if type_name in SystemConfigurationTypes: type = SystemConfigurationTypes[type_name] return JsonResponse(type.objects(id=config_id).first())
def update_system_configuration(config_id): """Update a specific system configuration""" type_name = load_system_configuration_type(ObjectId(config_id)) type = BaseSystemConfiguration if type_name in SystemConfigurationTypes: type = SystemConfigurationTypes[type_name] orig = type.objects(id=config_id).first() deserialize_that(read_request(), orig) orig.save() return JsonResponse(orig)