Document subclass registers itself against parent class

Issue #19 resolved
Andy Mikhaylenko
repo owner created an issue enable automatic selection of the most appropriate class for given record. Naïve API proposal: {{{ item = Event.object(db, pk, pick_best_subclass=True) }}} This fetches the record and wraps it either in an Event instance or in a more suitable subclass of Event, e.g. "Meeting", "Report", etc.

Use case: a timeline with various records from the same query; each is displayed using the most appropriate template(?). A simple helper can be used to manage templates vs. classes; it is only non-trivial to pick the classes.

Comments (1)

  1. Andy Mikhaylenko reporter

    Dropping the feature because Dark now provides a simple and clean way to pick a document class — the function dark.discovery.suggest_document_class. So nothing should be added to Docu itself to keep it simple. Instead, some stuff should be moved to Dark or to docu.ext.

  2. Log in to comment