Work on [#1280] showed that there is no good way to enumerate attachments within app/project, because we have wild varying object structure in the same collection, without type info on Ming level. Besides maintenance tasks like that ticket, it may be useful to provide admin tasks in the web app, like "list/moderate all attachments within project/tool".
Let's consider tracker app example. For it, attachments can be of types TicketAttachment (direct attachment to ticket) and DiscussionAttachment (attachment to ticket comment).
TicketAttachment has:
artifact_id=FieldProperty(S.ObjectId)
While DiscussionAttachment:
artifact_id=FieldProperty(str)
When doing M.TicketAttachment.query.find(), you'll get validation exception on first hit of DiscussionAttachment in the underlying collection, and vice-versa. So, you have to figure out additional duck-type style discriminators to add to find(), essentilly doing adhoc manual polymorphic_on. Rather, Ming should do that underneath.
description has changed
The script: