1
from django.contrib import admin
from import_export.admin import ImportExportModelAdmin
from .models import members

@admin.register(members)
class MembersAdmin(ImportExportModelAdmin):
    pass

this is my code in admin.py .actually i am trying to use import-export lib for my project while running in server it show the models i have created but its not showing the button where we can import export.(btw i am a noob in this field)

i need answer for my queries related to the python django library

1 Answer 1

0

I create test project and tried configure Django. It works

models.py:

from django.db import models

class Person(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)

admin.py:

from django.contrib import admin
from core.models import Person
from import_export import resources
from import_export.admin import ImportExportModelAdmin

class PersonResource(resources.ModelResource):
    class Meta:
        model = Person

class PersonAdmin(ImportExportModelAdmin):
    resource_classes = [PersonResource]

admin.site.register(Person, PersonAdmin)
Sign up to request clarification or add additional context in comments.

1 Comment

thanks actually i didnt see inside the model yes it works now!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.