Skip to content

markijbema/django-importexport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Usage

Lets say you have a Library of books, and if you export the library, you want to export the books as well, you could do this as follows:

class Library(models.Model, Exportable):
    def export_content(self):
        return self.books.all()


class Book(modes.Model, Exportable)
    library = models.ForeignKey(Library, related_name='books')

Now when you call library.export() you get the whole list of objects to serialize. You can then serialize those using the standard Django serialization methods. To ensure you can safely import the export elsewhere, be sure to use natural keys when exporting, and strip the pk's when importing.

About

Import and Export for django

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages