Reputation: 9616
I wish to use django import export.
https://pypi.python.org/pypi/django-import-export
While reading the documentation and after installing and configuring the package, I reached the "Creating Import-Export Resource' paragraph:
In which directory/file should I insert and save those lines of python that will create the resource?
Upvotes: 2
Views: 1060
Reputation: 5172
You can create this file anywhere in your project and then just import it where it's necessary.
So, following the docs, when your app is called core
:
#myproject/core/myresources.py
from import_export import resources
from core.models import Book
class BookResource(resources.ModelResource):
class Meta:
model = Book
And then anywhere in your project's code:
from core.myresources import BookResource
dataset = BookResource().export()
Upvotes: 2