django_importer/importers/base.py
def parse(self):
        """
        Parses all data from the source, saving model instances.
        """
        # Checks if the source is loaded
        if not self.loaded:
            self.load(self.source)
        
        for item in self.get_items():
            # Parse the fields from the source into a dict
            data = self.parse_item(item)
            # Get the instance from the DB, or a new one
            instance = self.get_instance(data)
            # Feed instance with data
            self.feed_instance(data, instance)
            # Try to save the instance or keep the error
            try:
                self.save_item(item, data, instance)
            except Exception as e:
                self.save_error(data, sys.exc_info())

        # Unload the source
        self.unload()
def parse(self):
        # Checks if the source is loaded
        if not self.loaded:
            self.load(self.source)
        
        for item in self.get_items():
            # Parse the fields from the source into a dict
            data = self.parse_item(item)
            # Get the instance from the DB, or a new one
            instance = self.get_instance(data)
            # Feed instance with data
            self.feed_instance(data, instance)
            # Try to save the instance or keep the error
            try:
                self.save_item(item, data, instance)
            except Exception as e:
                self.save_error(data, sys.exc_info())

        # Unload the source
        self.unload()
def parse ( self ) : # Checks if the source is loaded if not self . loaded : self . load ( self . source ) for item in self . get_items ( ) : # Parse the fields from the source into a dict data = self . parse_item ( item ) # Get the instance from the DB, or a new one instance = self . get_instance ( data ) # Feed instance with data self . feed_instance ( data , instance ) # Try to save the instance or keep the error try : self . save_item ( item , data , instance ) except Exception as e : self . save_error ( data , sys . exc_info ( ) ) # Unload the source self . unload ( )
Parses all data from the source, saving model instances.
Parses all data from the source saving model instances .