gnowledge/gstudio — pull request #177 by AvadootNachankar (2014-02-12 07:38:36+00:00)
Title: Changes regarding replacing 'gsystem_type' by 'member_of' field and removing 'gsystem_type' field from documents, if such exists!

* To replace gsystem_type by member_of field and drop gsystem_type field, perform following steps:

(1) Make sure following fields (with given data-types, if doesn't so make the necessary changes) exists in models.py file as it is:

(a) 'member_of' : [ObjectId] # list of ObjectId

(b) 'gsystem_type' : [ObjectId] # list of ObjectId
- NOTE: Must exist (under "GSystem" class) before going ahead!!

(2) Perform the following command:

- python manage.py migrate_member_of

- NOTE: This command replaces the occurences of member_of field having data stored as [unicode] by [ObjectId] (list of ObjectId) (values copied from gsystem_type field) in exsisting documents in the database; and also removes gsystem_type field from the corresponding documents. Exception to this, for documents having values GSystemType/AttributeType/RelationType for '__type' field, member_of field is kept empty (i.e. empty list []) as there is no MetaType defined for these types!

(3) IMPORTANT: Remove the following field explicitly from models.py:

- 'gsystem_type': [ObjectId] # list of ObjectId

- Otherwise, it is going to cause a major problem!!!

* Files created/modified:

(1) migrate_member_of.py file added in '.../management/commands/'

(2) Templates modified: Replaced 'node.member_of' by 'node.member_of_names_list'

(3) Views & Templatetags modified:

- Removed 'gsystem_type' field's existence

- Modified 'member_of' field's existence to access list of ObjectIds instead of list of unicode