python-drafthorse
python-drafthorse copied to clipboard
README example does not work
Trying to run the example code from the README file I get:
Traceback (most recent call last):
File "/tmp/dh/./dh", line 26, in <module>
note.content.add("Test Node 1")
^^^^^^^^^^^^^^^^
AttributeError: 'StringElement' object has no attribute 'add'
I believe a similar change to this needs to be applied: https://github.com/pretix/python-drafthorse/commit/b2d839f996a6ff00491a41384130a72c95d24118
You are right, the example was not updated after Note model change #69. To make it work, you can use:
doc.header.notes.add(IncludedNote(content="Test Node 1"))
instead of
note = IncludedNote()
note.content.add("Test Node 1")
doc.header.notes.add(note)
I've created the pull request #89 to update the example on the README