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
Metadata
Release files for model-import-export 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| model_import_export-0.1.4.tar.gz | 5.6 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| model_import_export-0.1.4-py3.7.egg | Legacy Egg format | - | - | Details |
| model_import_export-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.6 kB
Release files / model_import_export-0.1.4.tar.gz
| Download URL | model_import_export-0.1.4.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b0d981ebcdd9fdc30a05a2d22e9556aa55cfbdaae2d11b18aa0d6ed102dcfa0
|
|
BLAKE2b-256 checksum How to use checksums |
4f6fcf247262e910b2a6b5663520cfd518a3c84a486c2a9ae1156fb1f2c06ed6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.0
|
Release files / model_import_export-0.1.4-py3.7.egg
| Download URL | model_import_export-0.1.4-py3.7.egg |
|---|---|
| Size | 10.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
51944c973ddbf5d239590c36c5d31300dc43d88162ede31a0b5d7c395c4f33a7
|
|
BLAKE2b-256 checksum How to use checksums |
e8e183c40cf8a9d86a479e15ca9259102f4bbcd89b18b1026b14feac8c0dc7c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.0
|
Release files / model_import_export-0.1.4-py3-none-any.whl
| Download URL | model_import_export-0.1.4-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff2eac09920b64b7ce78d998b8da2597b2e192cfd03896748d6dd08faff9b0b0
|
|
BLAKE2b-256 checksum How to use checksums |
7a991aa8437e4bc5cf46cf51b3214649c0a914871a59cdff7931dd947ef8f20f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.7.0
|