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
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
Built Distribution
Close
Hashes for model_import_export-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5200ad3f7a020ff0f2af6e9d3c3624147f94c90a9cf001cecd5a0d1564490e9 |
|
MD5 | c657ce45c3ee7fab4127e99c48327cd4 |
|
BLAKE2b-256 | 9329cf6653da5d7bb95c51f1a4be121a0d591fc2ae6228b21cd0e2ed485c3410 |
Close
Hashes for model_import_export-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48d41b9f277bc3b0b1534a0701c7e9b7f4ed146a934fc2524d1630c942b8e9a0 |
|
MD5 | 79e78b392b2d62c7f63c50701a4cc6ca |
|
BLAKE2b-256 | f06e357fb3115dcf356222c0ea78daf112121435d1d978bca230d13f330bc9a9 |