gnowledge/gstudio — pull request #678 by AvadootNachankar (2014-08-19 21:13:21+00:00)
Title: MIS template updates - Multiple selection widget (Normal flow)

**Functionalities implemented:**

1) MIS related scripts updated

- File(s) modified:

1) management/commands/create_schema.py - ```Code added for parsing object_cardinality field of RelationType```

2) management/commands/data_entry.py - ```Find query updated: group_set field check added```

2) Updated: ```models.py```

- DELETED value added to status field's built-in choices

- get_possible_relations() function updated: Check added to fetch only PUBLISHED GRelation(s)

3) Updated: ```templatetags/ndf_tags.py```

- edit_drawer_widget() function uncommented
- Check added for special case: To deal with RelationType's object_type values

- html_widget() updated
- Necessary changes required for multiple-selection widget for RelationTypes
- New variables passed for template rendering - groupid and node_dict

4) Updated: ```views/methods.py```

- get_drawers() function updated
- Check added for special case: To deal with RelationType's object_type values

- create_grelation() function redesigned
- Based on RelationType's cardinality (one-to-one / one-to-many)

1) If one-to-one
- Accepts single ObjectId
- If different document value is passed, the existing one's status changed to 'DELETED'
- Later on if the DELETED document is again passed, instead of creating new one the existing one's status is changed to 'PUBLISHED'
- Hence, **no unecessary or redundant creations of GRelation documents**

2) If one-to-many
- Accepts list of ObjectIds
- Existing multiple GRelations (if exists) are checked against newly passed list of ObjectIds
- If matched
- Removed from newly passed list
- If PUBLISHED:
- prints Already existing
- Else (DELETED)
- status changed from 'DELETED' to 'PUBLISHED'

- Else (Not matched)
- status changed from 'PUBLISHED' to 'DELETED'

- If still newly passed list is not empty
- Remaining one's are created

5) Updated: Following templates & view

1) templates/ndf/html_field_widget.html

- Button added alongside dropdown shown as widget for listing RelationType's object_type values
- Onclick of button reveal-modal is shown that consists of drawer-widget
- On closing of reveal-modal, drawer2's values are shifted to outer dropdown

2) templates/ndf/person_create_edit.html

- Styles added to support drawer-widgets look n feel
- Reveal-modal's close event written
- Other necessary changes

3) templates/ndf/drawer_widget.html

- Previous commit's changes in this file swapped
- Necessary changes to support drawer-widget on reveal-modal

4) views/person.py

- Parsing code modified for dob field
- Necessary changes to support multiple-selection widget for RelationTypes