Wednesday, June 24, 2020

Getting exception while importing data though Django Admin

Exception:

\lib\site-packages\import_export\resources.py", line 581, in import_data
    raise ImproperlyConfigured
django.core.exceptions.ImproperlyConfigured




models.py


class Supplier(models.Model) :
supplier_id = models.IntegerField(primary_key=True)
supplier_name = models.CharField(null=False, max_length=500)

def __str__(self) :
return self.supplier_name


admin.py

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

from .models import *


# Register your models here.
# @admin.register(Supplier)
class SupplierAdmin(ImportExportModelAdmin) :
pass


resources.py

from import_export import resources

from .models import *


class SupplierResource(resources.ModelResource) :
class Meta :
model = Supplier
import_id_fields = ['supplier_id']

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/1b44dacf-3d42-4d6e-a482-c497ca60651fo%40googlegroups.com.

No comments:

Post a Comment