{"action":"created","issue":{"url":"https://api.github.com/repos/django-rea/rea-project/issues/2","repository_url":"https://api.github.com/repos/django-rea/rea-project","labels_url":"https://api.github.com/repos/django-rea/rea-project/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/django-rea/rea-project/issues/2/comments","events_url":"https://api.github.com/repos/django-rea/rea-project/issues/2/events","html_url":"https://github.com/django-rea/rea-project/issues/2","id":210610962,"number":2,"title":"Modularizing, single table inheritance and dynamic class loading","user":{"login":"escanda","id":13382418,"avatar_url":"https://avatars.githubusercontent.com/u/13382418?v=3","gravatar_id":"","url":"https://api.github.com/users/escanda","html_url":"https://github.com/escanda","followers_url":"https://api.github.com/users/escanda/followers","following_url":"https://api.github.com/users/escanda/following{/other_user}","gists_url":"https://api.github.com/users/escanda/gists{/gist_id}","starred_url":"https://api.github.com/users/escanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/escanda/subscriptions","organizations_url":"https://api.github.com/users/escanda/orgs","repos_url":"https://api.github.com/users/escanda/repos","events_url":"https://api.github.com/users/escanda/events{/privacy}","received_events_url":"https://api.github.com/users/escanda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-02-27T21:24:22Z","updated_at":"2017-02-28T09:05:26Z","closed_at":null,"body":"Although the title of this issue might sound a bit scaring I have been thinking thoroughly how we could achieve modular layers on which every fork could extend to their own necessities.\r\n\r\nThe first idea which comes to my mind is single table inheritance. Let's say OCP wants to implement `without_membership_request` in the `AgentManager` of _EconomicAgent_. Instead of modifying the base _EconomicAgent_ or its manager, OCP perhaps would extend _EconomicAgent_ to _OcpEconomicAgent_ and also extend `AgentManager` to `OcpAgentManager` so it includes this method.\r\n\r\nThe issue now could be how views decide which class to use, whether they use _EconomicAgent_ or _OcpEconomicAgent_.\r\n\r\nAs Django by default doesn't feature Single Table Inheritance (STI), we'd perhaps use this package https://github.com/django-polymorphic/django-polymorphic which implements this feature.\r\n\r\nThere are some alternatives in terms on hooking everything together I think:\r\n\r\n- Overriding AppConfig::get_model in Django and return _OcpEconomicAgent_ in place of _EconomicAgent_\r\n- Use settings as a placeholder on which to save a map of overridable classes.\r\n- ????\r\n\r\nThis is just a draft but I think we could make NRP more onion alike with this approach.\r\n\r\nWhich are your ideas to inheritance vs composition and also about class loading, or class selection?"},"comment":{"url":"https://api.github.com/repos/django-rea/rea-project/issues/comments/282982641","html_url":"https://github.com/django-rea/rea-project/issues/2#issuecomment-282982641","issue_url":"https://api.github.com/repos/django-rea/rea-project/issues/2","id":282982641,"user":{"login":"escanda","id":13382418,"avatar_url":"https://avatars.githubusercontent.com/u/13382418?v=3","gravatar_id":"","url":"https://api.github.com/users/escanda","html_url":"https://github.com/escanda","followers_url":"https://api.github.com/users/escanda/followers","following_url":"https://api.github.com/users/escanda/following{/other_user}","gists_url":"https://api.github.com/users/escanda/gists{/gist_id}","starred_url":"https://api.github.com/users/escanda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/escanda/subscriptions","organizations_url":"https://api.github.com/users/escanda/orgs","repos_url":"https://api.github.com/users/escanda/repos","events_url":"https://api.github.com/users/escanda/events{/privacy}","received_events_url":"https://api.github.com/users/escanda/received_events","type":"User","site_admin":false},"created_at":"2017-02-28T09:05:26Z","updated_at":"2017-02-28T09:05:26Z","body":"I've been in the IRC Django channel in Freenode (really exciting place to discuss Django stuff) and I was recommended to take a look at https://github.com/wq/django-swappable-models\r\n\r\nI will leave this note here so I don't forget :)"}}
{"actor":{"display_login":"escanda"}}