def import_nodes(self):
self.message('<STR_LIT>')<EOL>saved_nodes = []<EOL>for old_node in self.old_nodes:<EOL><INDENT>if old_node.status == '<STR_LIT:u>':<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>node = Node.objects.get(pk=old_node.id)<EOL><DEDENT>except Node.DoesNotExist:<EOL><INDENT>node = Node(id=old_node.id)<EOL>node.data = {}<EOL><DEDENT>node.user_id = self.users_dict[old_node.email]['<STR_LIT:id>']<EOL>node.name = old_node.name<EOL>node.slug = old_node.slug<EOL>node.geometry = Point(old_node.lng, old_node.lat)<EOL>node.elev = old_node.alt<EOL>node.description = old_node.description<EOL>node.notes = old_node.notes<EOL>node.added = old_node.added<EOL>node.updated = old_node.updated<EOL>node.data['<STR_LIT>'] = '<STR_LIT:true>'<EOL>intersecting_layers = node.intersecting_layers<EOL>if len(intersecting_layers) > <NUM_LIT:1>:<EOL><INDENT>answer = self.prompt_layer_selection(node, intersecting_layers)<EOL>if isinstance(answer, int):<EOL><INDENT>node.layer_id = answer<EOL><DEDENT>elif answer == '<STR_LIT:default>' and self.default_layer is not False:<EOL><INDENT>node.layer_id = self.default_layer<EOL><DEDENT>else:<EOL><INDENT>self.message('<STR_LIT>' % node.name)<EOL>continue<EOL><DEDENT><DEDENT>elif <NUM_LIT:2> > len(intersecting_layers) > <NUM_LIT:0>:<EOL><INDENT>node.layer = intersecting_layers[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>if self.default_layer is False:<EOL><INDENT>self.message("""<STR_LIT>""" % node.name)<EOL>continue<EOL><DEDENT>else:<EOL><INDENT>node.layer_id = self.default_layer<EOL><DEDENT><DEDENT>if old_node.postal_code:<EOL><INDENT>node.data['<STR_LIT>'] = old_node.postal_code<EOL><DEDENT>if old_node.status in ['<STR_LIT:h>', '<STR_LIT>']:<EOL><INDENT>node.data['<STR_LIT>'] = '<STR_LIT:true>'<EOL><DEDENT>if self.status_mapping:<EOL><INDENT>node.status_id = self.get_status(old_node.status)<EOL><DEDENT>try:<EOL><INDENT>node.full_clean()<EOL>node.save(auto_update=False)<EOL>saved_nodes.append(node)<EOL>self.verbose('<STR_LIT>' % (node.name, node.layer, node.status.name))<EOL><DEDENT>except Exception:<EOL><INDENT>tb = traceback.format_exc()<EOL>self.message('<STR_LIT>' % (node.name, tb))<EOL><DEDENT><DEDENT>self.message('<STR_LIT>' % len(saved_nodes))<EOL>self.saved_nodes = saved_nodes<EOL>
import nodes into local DB