-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new question type table supporting nested tables #212
Conversation
Sorry for the lengthy PR but is a bit of an advanced feature. |
Rebased to master and also made sure that only one new migrations is created. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just nitpicking, looks great to me!
caluma/form/serializers.py
Outdated
queryset=models.Document.objects, | ||
many=True, | ||
required=True, | ||
help_text="List of document ids whereas one document is one row in the table", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
help_text="List of document ids whereas one document is one row in the table", | |
help_text="List of document IDs, each representing one row in the table", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or probably even better: "List of document IDs representing the rows in the table"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adjusted
def update(self, instance, validated_data): | ||
documents = validated_data.pop("documents") | ||
|
||
# detach answers to its own family tree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is confusing me a bit. Aren't we detaching answers from their old family tree and afterwards reattaching them to the new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first they get deattached and attached again later on. I have added a comment whey they get attached to lower confusion.
* Introduce new answer type AnswerTable * A table format is represented by a form * A single row is represented as a document of question row form * JEXL expanded whereas a table answer is a list of dicts with question keys. * Introduce document family to allow access to a tree of documents introduced through table answer.
* Introduce new answer type AnswerTable * A table format is represented by a form * A single row is represented as a document of question row form * JEXL expanded whereas a table answer is a list of dicts with question keys. * Introduce document family to allow access to a tree of documents introduced through table answer.
keys.
introduced through table answer.