{ "info": { "author": "valdergallo", "author_email": "valdergallo@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Django", "Operating System :: OS Independent", "Topic :: Utilities" ], "description": "Django Data Importer\n====================\n\n|Build Status| |Latest Version| |Coverage Status| |BSD License| |PyPi\ndownloads| |Code Health| |Code Issues|\n\n**Django Data Importer** is a tool which allow you to transform easily a\n``CSV, XML, XLS and XLSX`` file into a python object or a django model\ninstance. It is based on the django-style declarative model.\n\nFeatures\n--------\n\n- Support to Django Customer User\n- (beta) QuerysetToWorkbook\n- Ignore empty line\n- Accept custom clean\\_fields\n- Accept post\\_clean\n- Accept post\\_save\n- Accept post\\_save\\_all\\_lines\n- Accept pre\\_clean\n- Accept pre\\_commit\n- Accept save with transaction\n- Auto generate async importers\n- Auto Importer CSV\n- Auto Importer XLS\n- Auto Importer XLSX\n- Auto Importer XML\n- Check import status on Django Admin\n- Convert text values by default as unicode\n- Default FormView\n- Django Admin integration to download files in File History\n- Easy interface to create Importers\n- Easy interface to create Readers\n- File History integrated with FormView\n- GenericImporter to import files (CSV, XLS, XLSX, XML)\n- Get fields from Django Models\n- Ignore First Row\n- Integrated with Celery\n- Integrated with Django Models\n- Integrated with Django Models Validators\n- Open file to read\n- Read source as File, cStringIO, Text, FileField\n- Set starting\\_row\n- Set XLS/XLSX importer by sheet\\_index\n- Set XLS/XLSX importer by sheet\\_name\n- Support to user a JSON descriptor with Fields\n- Fields as OrderedDict with text position\n\nInstallation\n------------\n\nUse either ``easy_install``:\n\n::\n\n easy_install data-importer\n\nor ``pip``:\n\n::\n\n pip install data-importer\n\nSettings\n--------\n\nCustomize data\\_importer decoders\n\n **DATA\\_IMPORTER\\_EXCEL\\_DECODER**\\ Default value is cp1252\n\n **DATA\\_IMPORTER\\_DECODER**\\ Default value is UTF-8\n\nAdd support to South Migrations and Django Migrations\n\n::\n\n SOUTH_MIGRATION_MODULES = {\n 'data_importer': 'data_importer.south_migrations',\n }\n\n MIGRATION_MODULES = {\n 'data_importer': 'data_importer.django_migrations'\n },\n\nBasic example\n-------------\n\nConsider the following:\n\n::\n\n >>> from data_importer.importers import CSVImporter\n >>> class MyCSVImporterModel(CSVImporter):\n ... fields = ['name', 'age', 'length']\n ... class Meta:\n ... delimiter = \";\"\n\nYou declare a ``MyCSVImporterModel`` which will match to a CSV file like\nthis:\n\n::\n\n Anthony;27;1.75\n\nTo import the file or any iterable object, just do:\n\n::\n\n >>> my_csv_list = MyCSVImporterModel(source=\"my_csv_file_name.csv\")\n >>> row, first_line = my_csv_list.cleaned_data[0]\n >>> first_line['age']\n 27\n\nWithout an explicit declaration, data and columns are matched in the\nsame order:\n\n::\n\n Anthony --> Column 0 --> Field 0 --> name\n 27 --> Column 1 --> Field 1 --> age\n 1.75 --> Column 2 --> Field 2 --> length\n\nUsing Fields as Dict\n--------------------\n\nYou can use diferents ways to define the fields as dicts\n\n::\n\n >>> class TestMetaDict(XLSImporter):\n ... fields = OrderedDict((\n ... ('business_place', 'A'),\n ... ('doc_number', 'b'),\n ... ('doc_data', 'C'),\n ... ))\n\nor\n\n::\n\n >>> class TestMetaDict(XLSImporter):\n ... fields = OrderedDict((\n ... ('business_place', 0),\n ... ('doc_number', 1),\n ... ('doc_data', 2),\n ... ))\n\nor\n\n::\n\n >>> class TestMetaDict(XLSImporter):\n ... fields = OrderedDict((\n ... ('business_place', '0'),\n ... ('doc_number', 1,)\n ... ('doc_data', 'C'),\n ... ))\n\nUsing declaration, data and columns are matched in the same order:\n\n::\n\n New York --> Column 0 --> Field 0 --> business_place\n 664736 --> Column 1 --> Field 1 --> doc_number\n 2015-01-01 --> Column 2 --> Field 2 --> doc_data\n\nDjango Model\n------------\n\nIf you now want to interact with a django model, you just have to add a\n**Meta.model** option to the class meta.\n\n::\n\n >>> from django.db import models\n >>> class MyModel(models.Model):\n ... name = models.CharField(max_length=150)\n ... age = models.CharField(max_length=150)\n ... length = models.CharField(max_length=150)\n\n >>> from data_importer.importers import CSVImporter\n >>> from data_importer.model import MyModel\n >>> class MyCSVImporterModel(CSVImporter):\n ... class Meta:\n ... delimiter = \";\"\n ... model = MyModel\n\nThat will automatically match to the following django model.\n\n*The django model should be imported in the model*\n\n **delimiter**\\ define the delimiter of the csv file. If you do not\n set one, the sniffer will try yo find one itself.\n\n **ignore\\_first\\_line**\\ Skip the first line if True.\n\n **model**\\ If defined, the importer will create an instance of this\n model.\n\n **raise\\_errors**\\ If set to True, an error in a imported line will\n stop the loading.\n\n **exclude**\\ Exclude fields from list fields to import\n\n **transaction**\\ Use transaction to save objects\n\nDjango XML\n----------\n\nIf you now want to interact with a django model, you just have to add a\n**Meta.model** option to the class meta.\n\nXML file example:\n\n::\n\n \n \n Rocky Balboa\n 40\n 1.77\n \n \n Chuck Norris\n 73\n 1.78\n \n \n\n >>> from django.db import models\n >>> class MyModel(models.Model):\n ... name = models.CharField(max_length=150)\n ... age = models.CharField(max_length=150)\n ... height = models.CharField(max_length=150)\n\n >>> from data_importer.importers import XMLImporter\n >>> from data_importer.model import MyModel\n >>> class MyCSVImporterModel(XMLImporter):\n ... root = 'file'\n ... class Meta:\n ... model = MyModel\n\nThat will automatically match to the following django model.\n\n*The django model should be imported in the model*\n\n **model**\\ If defined, the importer will create an instance of this\n model.\n\n **raise\\_errors**\\ If set to True, an error in a imported line will\n stop the loading.\n\n **exclude**\\ Exclude fields from list fields to import\n\n **transaction**\\ Use transaction to save objects\n\nDjango XLS/XLSX\n---------------\n\nMy XLS/XLSX file can be imported too\n\n+-----------+-----------+-----------+-----------+\n| Header1 | Header2 | Header3 | Header4 |\n+===========+===========+===========+===========+\n| Teste 1 | Teste 2 | Teste 3 | Teste 4 |\n+-----------+-----------+-----------+-----------+\n| Teste 1 | Teste 2 | Teste 3 | Teste 4 |\n+-----------+-----------+-----------+-----------+\n\nThis is my model\n\n::\n\n >>> from django.db import models\n >>> class MyModel(models.Model):\n ... header1 = models.CharField(max_length=150)\n ... header2 = models.CharField(max_length=150)\n ... header3 = models.CharField(max_length=150)\n ... header4 = models.CharField(max_length=150)\n\nThis is my class\n\n::\n\n >>> from data_importer import XLSImporter\n >>> from data_importer.model import MyModel\n >>> class MyXLSImporterModel(XLSImporter):\n ... class Meta:\n ... model = MyModel\n\nIf you are using XLSX you will need use ``XLSXImporter`` to made same\nimporter\n\n::\n\n >>> from data_importer import XLSXImporter\n >>> from data_importer.model import MyModel\n >>> class MyXLSXImporterModel(XLSXImporter):\n ... class Meta:\n ... model = MyModel\n\n **ignore\\_first\\_line**\\ Skip the first line if True.\n\n **model** If defined, the importer will create an instance of this\n model.\n\n **raise\\_errors**\\ If set to True, an error in a imported line will\n stop the loading.\n\n **exclude**\\ Exclude fields from list fields to import\n\n **transaction** Use transaction to save objects\n\nDescriptor\n----------\n\nUsing file descriptor to define fields for large models.\n\nimport\\_test.json\n\n::\n\n {\n 'app_name': 'mytest.Contact',\n {\n // field name / name on import file or key index\n 'name': 'My Name',\n 'year': 'My Year',\n 'last': 3\n }\n }\n\nmodel.py\n\n::\n\n class Contact(models.Model):\n name = models.CharField(max_length=50)\n year = models.CharField(max_length=10)\n laster = models.CharField(max_length=5)\n phone = models.CharField(max_length=5)\n address = models.CharField(max_length=5)\n state = models.CharField(max_length=5)\n\nimporter.py\n\n::\n\n class MyImpoter(BaseImpoter):\n class Meta:\n config_file = 'import_test.json'\n model = Contact\n delimiter = ','\n ignore_first_line = True\n\ncontent\\_file.csv\n\n::\n\n name,year,last\n Test,12,1\n Test2,13,2\n Test3,14,3\n\nDefault DataImporterForm\n------------------------\n\n``DataImporterForm`` is one ``django.views.generic.edit.FormView`` to\n**save file** in ``FileUpload`` and parse content on success.\n\nExample\n-------\n\n::\n\n class DataImporterCreateView(DataImporterForm):\n extra_context = {'title': 'Create Form Data Importer',\n 'template_file': 'myfile.csv'\n }\n importer = MyCSVImporterModel\n\nTEST\n----\n\n+-------------------------+------------------+----------+\n| Acentuation with XLS | Excel MAC 2011 | **OK** |\n+=========================+==================+==========+\n| Acentuation with XLS | Excel WIN 2010 | **OK** |\n+-------------------------+------------------+----------+\n| Acentuation with XLSX | Excel MAC 2011 | **OK** |\n+-------------------------+------------------+----------+\n| Acentuation with XLSX | Excel WIN 2010 | **OK** |\n+-------------------------+------------------+----------+\n| Acentuation with CSV | Excel Win 2010 | **OK** |\n+-------------------------+------------------+----------+\n\n+----------+--------+\n| Python | 3.4+ |\n+==========+========+\n| Python | 2.7+ |\n+----------+--------+\n| Django | 1.3+ |\n+----------+--------+\n\n.. |Build Status| image:: https://travis-ci.org/valdergallo/data-importer.png?branch=master\n :target: https://travis-ci.org/valdergallo/data-importer\n.. |Latest Version| image:: http://img.shields.io/pypi/v/data-importer.svg\n :target: https://pypi.python.org/pypi/data-importer\n.. |Coverage Status| image:: https://coveralls.io/repos/valdergallo/data-importer/badge.png\n :target: https://coveralls.io/r/valdergallo/data-importer\n.. |BSD License| image:: http://img.shields.io/badge/license-BSD-yellow.svg\n :target: http://opensource.org/licenses/BSD-3-Clause\n.. |PyPi downloads| image:: https://img.shields.io/pypi/dm/data-importer.svg\n :target: https://pypi.python.org/pypi/data-importer\n.. |Code Health| image:: https://landscape.io/github/valdergallo/data-importer/master/landscape.svg?style=flat\n :target: https://landscape.io/github/valdergallo/data-importer/master\n.. |Code Issues| image:: https://www.quantifiedcode.com/api/v1/project/3d514a9783bc40f5a9db7f9c8a72dad1/badge.svg\n :target: https://www.quantifiedcode.com/app/project/3d514a9783bc40f5a9db7f9c8a72dad1\n", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/valdergallo/data-importer/tarball/3.0.2/", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/valdergallo/data-importer", "keywords": "Django Data Importer XLS XLSX CSV XML", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "data-importer", "package_url": "https://pypi.org/project/data-importer/", "platform": "any", "project_url": "https://pypi.org/project/data-importer/", "project_urls": { "Download": "https://github.com/valdergallo/data-importer/tarball/3.0.2/", "Homepage": "https://github.com/valdergallo/data-importer" }, "release_url": "https://pypi.org/project/data-importer/3.0.2/", "requires_dist": null, "requires_python": "", "summary": "Simple library to easily import data with Django", "version": "3.0.2" }, "last_serial": 2520659, "releases": { "2.0.7": [ { "comment_text": "", "digests": { "md5": "bb91252d201464d4d7748ef51280953b", "sha256": "462435854f5e34e8fd2a3a931387f66dc57ed82d8f8608687ce533be896fb19d" }, "downloads": -1, "filename": "data-importer-2.0.7.tar.gz", "has_sig": false, "md5_digest": "bb91252d201464d4d7748ef51280953b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17379, "upload_time": "2015-01-16T14:14:56", "url": "https://files.pythonhosted.org/packages/1d/4a/1afa8425931eb221faceb3b20c0b3b8327d05bf5a50bfdbc6005885d16a9/data-importer-2.0.7.tar.gz" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "cb6fe78e3a6f0dd61426255fbb20aa13", "sha256": "a8ecdff175530112ac40edf93453f8dad549ad494e89b9744fc03c366a76a097" }, "downloads": -1, "filename": "data-importer-2.1.0.tar.gz", "has_sig": false, "md5_digest": "cb6fe78e3a6f0dd61426255fbb20aa13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17465, "upload_time": "2015-01-20T18:56:02", "url": "https://files.pythonhosted.org/packages/37/f8/8b8bd788362f4daa602f2a4456906a84cc9a0e16048477f5dbab59a0e7b0/data-importer-2.1.0.tar.gz" } ], "2.2.0": [ { "comment_text": "", "digests": { "md5": "581b855c7e7b2198278e91fea49a86db", "sha256": "056cd2f310aaca0f5592ae7bab207697f3aecece281ddfbf8f78d23e75fdad4a" }, "downloads": -1, "filename": "data-importer-2.2.0.tar.gz", "has_sig": false, "md5_digest": "581b855c7e7b2198278e91fea49a86db", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17749, "upload_time": "2015-01-28T23:12:21", "url": "https://files.pythonhosted.org/packages/d2/a7/ccf8b9c17d23bfb4f8451a76c387a30fedaf39f1e0ee80857a332f1387a9/data-importer-2.2.0.tar.gz" } ], "2.2.1": [ { "comment_text": "", "digests": { "md5": "fa50b3d3310ddb89ccab92be41617f43", "sha256": "3c26d2fc8ed1e4b946d623d10de19ec79820137d865c83e81c8c5d7c97b29e89" }, "downloads": -1, "filename": "data-importer-2.2.1.tar.gz", "has_sig": false, "md5_digest": "fa50b3d3310ddb89ccab92be41617f43", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17826, "upload_time": "2015-02-13T09:54:34", "url": "https://files.pythonhosted.org/packages/73/a2/80aac6527167b261014a059d5a3fc2e057c7b37efa1ce9b1542718ed56c2/data-importer-2.2.1.tar.gz" } ], "2.2.2": [ { "comment_text": "", "digests": { "md5": "cb7b51b0f1575b07218e1de3e7c9e996", "sha256": "1392e4efef9cae90b9d8fef523dd43cfdc1f00702aaae256ee66fa569e6a91ee" }, "downloads": -1, "filename": "data-importer-2.2.2.zip", "has_sig": false, "md5_digest": "cb7b51b0f1575b07218e1de3e7c9e996", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 28530, "upload_time": "2015-08-28T13:20:38", "url": "https://files.pythonhosted.org/packages/3f/ce/0497321cd4994477c1c7542c828c465382eb53400076f6ff55e8e8625296/data-importer-2.2.2.zip" } ], "2.3.0": [], "2.3.1": [], "2.3.2": [ { "comment_text": "", "digests": { "md5": "1bd591608b0c0de28d570dddc8fd9dd8", "sha256": "c11b832a43f0621d74df3425108f42098fbdec1853ab7686daedd2b030029ea7" }, "downloads": -1, "filename": "data-importer-2.3.2.tar.gz", "has_sig": false, "md5_digest": "1bd591608b0c0de28d570dddc8fd9dd8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18944, "upload_time": "2016-01-12T17:47:47", "url": "https://files.pythonhosted.org/packages/3f/8d/feab233c892eda5cd0417cbde8343c3f76f1978588b1eb8b26d4af4d8c3b/data-importer-2.3.2.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "dd36265b2eb6a37f48f0b0cc90b09b7f", "sha256": "e54c3955e11a2590c5222d55a88965b4242cfbfec5bdbd9d89a53d21422f1828" }, "downloads": -1, "filename": "data-importer-3.0.0.tar.gz", "has_sig": false, "md5_digest": "dd36265b2eb6a37f48f0b0cc90b09b7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14278, "upload_time": "2016-10-09T03:51:12", "url": "https://files.pythonhosted.org/packages/9d/c5/be1e827b76e42cf5e78c9a319ff1434e85ed86bee1088ca201c7b2cb94f1/data-importer-3.0.0.tar.gz" } ], "3.0.1": [ { "comment_text": "", "digests": { "md5": "558b452d367bdf04b5b521feb10c0526", "sha256": "751ca7fb24b405f964eab08f7cfbac7b90e3e4cca4fcfd3e5d1279b628063b31" }, "downloads": -1, "filename": "data-importer-3.0.1.tar.gz", "has_sig": false, "md5_digest": "558b452d367bdf04b5b521feb10c0526", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18370, "upload_time": "2016-10-09T22:39:37", "url": "https://files.pythonhosted.org/packages/ee/81/315014a43c16488eec97b05b1d3d3ea477f431a656200bd3e1ae498509bd/data-importer-3.0.1.tar.gz" } ], "3.0.2": [ { "comment_text": "", "digests": { "md5": "8dc954165e6a99cf9f0f9bdc97390b72", "sha256": "8825f9ae9d3cb5a364fcb3378166e805f67eef9dfae058bf39e9906e4e7b8c1c" }, "downloads": -1, "filename": "data-importer-3.0.2.tar.gz", "has_sig": false, "md5_digest": "8dc954165e6a99cf9f0f9bdc97390b72", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18347, "upload_time": "2016-12-15T09:23:00", "url": "https://files.pythonhosted.org/packages/d8/2a/16d7a6271f8f3120ce3ee80639cf1b495d31d1f34d76f7fdec6fbd307adc/data-importer-3.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8dc954165e6a99cf9f0f9bdc97390b72", "sha256": "8825f9ae9d3cb5a364fcb3378166e805f67eef9dfae058bf39e9906e4e7b8c1c" }, "downloads": -1, "filename": "data-importer-3.0.2.tar.gz", "has_sig": false, "md5_digest": "8dc954165e6a99cf9f0f9bdc97390b72", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18347, "upload_time": "2016-12-15T09:23:00", "url": "https://files.pythonhosted.org/packages/d8/2a/16d7a6271f8f3120ce3ee80639cf1b495d31d1f34d76f7fdec6fbd307adc/data-importer-3.0.2.tar.gz" } ] }