Skip to content

Commit 0b8ab58

Browse files
author
Mark IJbema
committed
fixed formatting
1 parent 4ae88fe commit 0b8ab58

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

README.md

+5-7
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
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:
44

5-
'''
6-
class Library(models.Model, Exportable):
7-
def export_content(self):
8-
return self.books.all()
5+
class Library(models.Model, Exportable):
6+
def export_content(self):
7+
return self.books.all()
98

109

11-
class Book(modes.Model, Exportable)
12-
library = models.ForeignKey(Library, related_name='books')
10+
class Book(modes.Model, Exportable)
11+
library = models.ForeignKey(Library, related_name='books')
1312

14-
'''
1513

1614
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.

0 commit comments

Comments
 (0)