Skip to content

Commit

Permalink
Merge pull request #1353 from matthewhegarty/example-app-walkthrough-…
Browse files Browse the repository at this point in the history
…doc-update

Documentation: correct error in example application which leads to crash
  • Loading branch information
matthewhegarty committed Nov 23, 2021
2 parents 74cf8ee + 5399c69 commit 7b1e392
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changelog
- Add ability to rollback the import on validation error (#1339)
- Fix missing migration on example app (#1346)
- Fix crash when deleting via admin site (#1347)
- Documentation: correct error in example application which leads to crash (#1353)

2.6.1 (2021-09-30)
------------------
Expand Down
12 changes: 11 additions & 1 deletion docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
Getting started
===============

Test data
=========

There are test data files which can be used for importing in the `test/core/exports` directory.

The test models
===============

For example purposes, we'll use a simplified book app. Here is our
``models.py``::

Expand Down Expand Up @@ -188,7 +196,9 @@ data structure on export, ``dehydrate_<fieldname>`` method should be defined::
model = Book

def dehydrate_full_title(self, book):
return '%s by %s' % (book.name, book.author.name)
book_name = getattr(book, "name", "unknown")
author_name = getattr(book.author, "name", "unknown")
return '%s by %s' % (book_name, author_name)

In this case, the export looks like this:

Expand Down

0 comments on commit 7b1e392

Please sign in to comment.