Skip to main content

Import/Export feature for django models

Project description

model-import-export

Imports and Exports django model to excel and csv

Requirement

python >= 3
Django 1.11.5, >= 2.11

Installation

pip install model-import-export

Usage

Creating resources

In your example_app/resources.py

from model_import_export.resources import ModelResource, ForeignKeyResource, ManyToManyResource

from dashboard.models import *

class UserResource(ModelResource):

	class Meta:
		model = User
		fields = '__all__'

Exporting model

from .resources import UserResource

queryset = User.objects.all()
resource = UserResource(queryset)
resource.to_excel('users.xlsx')

Importing model

resource = UserResource()
resource.from_excel('users.xlsx')

Model Import/Export Example

GitHub model_import_export_example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

model_import_export-0.1.3.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

model_import_export-0.1.3-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file model_import_export-0.1.3.tar.gz.

File metadata

  • Download URL: model_import_export-0.1.3.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.0

File hashes

Hashes for model_import_export-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f5200ad3f7a020ff0f2af6e9d3c3624147f94c90a9cf001cecd5a0d1564490e9
MD5 c657ce45c3ee7fab4127e99c48327cd4
BLAKE2b-256 9329cf6653da5d7bb95c51f1a4be121a0d591fc2ae6228b21cd0e2ed485c3410

See more details on using hashes here.

File details

Details for the file model_import_export-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for model_import_export-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 48d41b9f277bc3b0b1534a0701c7e9b7f4ed146a934fc2524d1630c942b8e9a0
MD5 79e78b392b2d62c7f63c50701a4cc6ca
BLAKE2b-256 f06e357fb3115dcf356222c0ea78daf112121435d1d978bca230d13f330bc9a9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page