importwizard — Camelot documentation

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »
- wizard »

# importwizard

Module for managing imports

class `camelot.view.wizard.importwizard.` `CsvCollectionGetter`(filename)

  Returns data from csv file as a list of RowData objects

class `camelot.view.wizard.importwizard.` `DataPreviewPage`(parent=None, model=None, collection_getter=None)

  DataPreviewPage is the previewing page for the import wizard

  `initializePage`()

    Gets all info needed from SelectFilePage and feeds table

class `camelot.view.wizard.importwizard.` `FinalPage`(parent=None, model=None, admin=None)

  FinalPage is the final page in the import process

class `camelot.view.wizard.importwizard.` `ImportWizard`(parent=None, admin=None)

  ImportWizard provides a two-step wizard for importing data as objects into Camelot. To create a custom wizard, subclass this ImportWizard and overwrite its class attributes.

  To import a different file format, you probably need a custom collection_getter for this file type.

  `add_pages`(model, admin)

    Add all pages to the import wizard, reimplement this method to add custom pages to the wizard. This method is called in the __init__ method, to add all pages to the wizard.

    Parameters: | model – the CollectionProxy that will be used to display the to

    be imported data :param admin: the admin of the destination data

  `collection_getter`

    alias of `CsvCollectionGetter`

  `data_preview_page`

    alias of `DataPreviewPage`

  `final_page`

    alias of `FinalPage`

  `rowdata_admin_decorator`

    alias of `RowDataAdminDecorator`

  `select_file_page`

    alias of `SelectFilePage`

class `camelot.view.wizard.importwizard.` `RowData`(row_number, row_data)

  Class representing the data in a single row of the imported file as an object with attributes column_1, column_2, ..., each representing the data in a single column of that row.

  since the imported file might contain less columns than expected, the RowData object returns None for not existing attributes

class `camelot.view.wizard.importwizard.` `RowDataAdminDecorator`(object_admin)

  Decorator that transforms the Admin of the class to be imported to an Admin of the RowData objects to be used when previewing and validating the data to be imported.

  based on the field attributes of the original mode, it will turn the background color pink if the data is invalid for being imported.

  `create_validator`(model)

    Creates a validator that validates the data to be imported, the validator will check if the background of the cell is pink, and if it is it will mark that object as invalid.

  `flush`(obj)

    When flush is called, don’t do anything, since we’ll only save the object when importing them for real

class `camelot.view.wizard.importwizard.` `UTF8Recoder`(f, encoding)

  Iterator that reads an encoded stream and reencodes the input to UTF-8.

class `camelot.view.wizard.importwizard.` `UnicodeReader`(f, dialect=<class csv.excel at 0xd0731ac>, encoding='utf-8', **kwds)

  A CSV reader which will iterate over lines in the CSV file “f”, which is encoded in the given encoding.

class `camelot.view.wizard.importwizard.` `XlsCollectionGetter`(filename, encoding='utf-8')

  Returns the data from excel file as a list of RowData objects

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »
- wizard »

Comments
blog comments powered by Disqus