{"action":"opened","issue":{"url":"https://api.github.com/repos/allegro/ralph/issues/2158","labels_url":"https://api.github.com/repos/allegro/ralph/issues/2158/labels{/name}","comments_url":"https://api.github.com/repos/allegro/ralph/issues/2158/comments","events_url":"https://api.github.com/repos/allegro/ralph/issues/2158/events","html_url":"https://github.com/allegro/ralph/issues/2158","id":127202293,"number":2158,"title":"REP10: Custom fields","user":{"login":"mkurek","id":107437,"avatar_url":"https://avatars.githubusercontent.com/u/107437?v=3","gravatar_id":"","url":"https://api.github.com/users/mkurek","html_url":"https://github.com/mkurek","followers_url":"https://api.github.com/users/mkurek/followers","following_url":"https://api.github.com/users/mkurek/following{/other_user}","gists_url":"https://api.github.com/users/mkurek/gists{/gist_id}","starred_url":"https://api.github.com/users/mkurek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkurek/subscriptions","organizations_url":"https://api.github.com/users/mkurek/orgs","repos_url":"https://api.github.com/users/mkurek/repos","events_url":"https://api.github.com/users/mkurek/events{/privacy}","received_events_url":"https://api.github.com/users/mkurek/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/allegro/ralph/labels/blueprint","name":"blueprint","color":"bfe5bf"},{"url":"https://api.github.com/repos/allegro/ralph/labels/REP","name":"REP","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-18T10:57:26Z","updated_at":"2016-01-18T10:57:26Z","closed_at":null,"body":"Custom fields requirements (for user):\r\n- field could be attached to any model (BaseObject, DCA, Service etc)\r\n- field could have limitation on value type (ex. have to be int, string, url, bool)\r\n- field could have limitation on possible choices (like html's select field)\r\n- field could have some preconditions when it's displayed (ex. when Venture is XXX, show field YYY for DataCenterAsset, when model (or model category) is AAA show field BBB for BackOfficeAsset etc)\r\n- field should be easily filtered (even with Django dunder convention for nested models) in GUI and API\r\n- defined fields should only be \"hints\" for particular object (with default value filled by default) - there should be possibility to declare custom (completely, not defined anywhere) field name and value for any object\r\n\r\n\r\nDevelopment requirements:\r\n- integrated with django admin\r\n- database-agnostic\r\n- performance\r\n- not-complex (easy to extend and modify)\r\n\r\n\r\nPossible solutions:\r\n- EAV\r\n- JSONField\r\n- ... ?\r\n\r\n\r\nInspiration / resources:\r\n- http://www.slideshare.net/schacki/django-dynamic-models20130502\r\n- https://en.wikipedia.org/wiki/Entity%E2%80%93attribute%E2%80%93value_model\r\n- http://stackoverflow.com/questions/7933596/django-dynamic-model-fields\r\n\r\n- https://github.com/willseward/django-custom-field\r\n- https://github.com/mvpdev/django-eav\r\n- https://bitbucket.org/neithere/eav-django/\r\n\r\n- https://github.com/allegro/ralph/pull/1316\r\n- Ralph 2.0 CMDB Custom fields (CIAttribute): https://github.com/allegro/ralph/blob/develop/src/ralph/cmdb/models_ci.py , `<RALPH_URL>/admin/cmdb/ciattribute/`\r\n- Ralph 2.0 Ventures properties https://github.com/allegro/ralph/blob/develop/src/ralph/business/models.py#L342 , `<RALPH_URL>/admin/business/rolepropertytype/`"}}