How to Import-Export data in Django?

0
214
import export data in django

Today I will teach you how Import Export works in Django.

First Install the import export package in your Django app using this command

pip3 install django-import-export

now go to your admin.py file, and register your model there

from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from .models import Product

@admin.register(Product)
class ViewAdmin(ImportExportModelAdmin):
pass

Register module in settings.py file

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'import_export',
]

Now Run Your server using this command python3 manage.py runserver

LEAVE A REPLY

Please enter your comment!
Please enter your name here