-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new question type table supporting nested tables (#212)
* Add new question type table supporting nested tables * 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. * Add new question type table supporting nested tables * 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.
- Loading branch information
Showing
18 changed files
with
720 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.18 on 2019-01-30 09:20 | ||
from __future__ import unicode_literals | ||
|
||
import uuid | ||
|
||
import django.contrib.postgres.fields.jsonb | ||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [("form", "0002_auto_20181221_1517")] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="AnswerDocument", | ||
fields=[ | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
("modified_at", models.DateTimeField(auto_now=True)), | ||
( | ||
"created_by_user", | ||
models.CharField(blank=True, max_length=150, null=True), | ||
), | ||
( | ||
"created_by_group", | ||
models.CharField( | ||
blank=True, db_index=True, max_length=150, null=True | ||
), | ||
), | ||
( | ||
"id", | ||
models.UUIDField( | ||
default=uuid.uuid4, | ||
editable=False, | ||
primary_key=True, | ||
serialize=False, | ||
), | ||
), | ||
( | ||
"sort", | ||
models.PositiveIntegerField( | ||
db_index=True, default=0, editable=False | ||
), | ||
), | ||
], | ||
options={"ordering": ("-sort", "id")}, | ||
), | ||
migrations.AddField( | ||
model_name="document", | ||
name="family", | ||
field=models.UUIDField( | ||
db_index=True, | ||
default=uuid.uuid4, | ||
help_text="Family id which document belongs too.", | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="question", | ||
name="row_form", | ||
field=models.ForeignKey( | ||
blank=True, | ||
help_text="One row of table is represented by this form", | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="+", | ||
to="form.Form", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="answer", | ||
name="value", | ||
field=django.contrib.postgres.fields.jsonb.JSONField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name="question", | ||
name="type", | ||
field=models.CharField( | ||
choices=[ | ||
("checkbox", "checkbox"), | ||
("integer", "integer"), | ||
("float", "float"), | ||
("radio", "radio"), | ||
("textarea", "textarea"), | ||
("text", "text"), | ||
("table", "table"), | ||
], | ||
max_length=10, | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="answerdocument", | ||
name="answer", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="form.Answer" | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="answerdocument", | ||
name="document", | ||
field=models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, to="form.Document" | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="answer", | ||
name="documents", | ||
field=models.ManyToManyField( | ||
related_name="_answer_documents_+", | ||
through="form.AnswerDocument", | ||
to="form.Document", | ||
), | ||
), | ||
migrations.AlterUniqueTogether( | ||
name="answerdocument", unique_together=set([("answer", "document")]) | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.