Skip to main content

Import/Export feature for django models

Project description


Imports and Exports django model to excel and csv


python >= 3
Django 1.11.5, >= 2.11


pip install model-import-export


Creating resources

In your example_app/

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)

Importing model

resource = UserResource()

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 hashes)

Uploaded Source

Built Distributions

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

Uploaded Source

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

Uploaded Python 3

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