Skip to content
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

Merged
merged 2 commits into from
Jan 30, 2019

Conversation

sliverc
Copy link
Member

@sliverc sliverc commented Jan 29, 2019

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

@sliverc sliverc requested review from winged and czosel January 29, 2019 12:48
@sliverc
Copy link
Member Author

sliverc commented Jan 29, 2019

Sorry for the lengthy PR but is a bit of an advanced feature.

@sliverc
Copy link
Member Author

sliverc commented Jan 29, 2019

Rebased to master and also made sure that only one new migrations is created.

Copy link
Contributor

@czosel czosel left a 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!

queryset=models.Document.objects,
many=True,
required=True,
help_text="List of document ids whereas one document is one row in the table",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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",

Copy link
Contributor

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"

Copy link
Member Author

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
Copy link
Contributor

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?

Copy link
Member Author

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants