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.4.tar.gz (5.6 kB view details)

Uploaded Source

Built Distributions

model_import_export-0.1.4-py3.7.egg (10.9 kB view details)

Uploaded Source

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: model_import_export-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 1b0d981ebcdd9fdc30a05a2d22e9556aa55cfbdaae2d11b18aa0d6ed102dcfa0
MD5 c17c1eaa488037e68755b7e89ffb117d
BLAKE2b-256 4f6fcf247262e910b2a6b5663520cfd518a3c84a486c2a9ae1156fb1f2c06ed6

See more details on using hashes here.

File details

Details for the file model_import_export-0.1.4-py3.7.egg.

File metadata

File hashes

Hashes for model_import_export-0.1.4-py3.7.egg
Algorithm Hash digest
SHA256 51944c973ddbf5d239590c36c5d31300dc43d88162ede31a0b5d7c395c4f33a7
MD5 67c476f6865586a15a56a589519996df
BLAKE2b-256 e8e183c40cf8a9d86a479e15ca9259102f4bbcd89b18b1026b14feac8c0dc7c3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for model_import_export-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ff2eac09920b64b7ce78d998b8da2597b2e192cfd03896748d6dd08faff9b0b0
MD5 711fd595fd9fc5afb7c974c9623c7120
BLAKE2b-256 7a991aa8437e4bc5cf46cf51b3214649c0a914871a59cdff7931dd947ef8f20f

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