On 23 nov, 13:08, Ben Scherrey <proteus...@gmail.com> wrote: > We are attempting to apply the concepts of Domain-Context > Interaction (DCI) to our python/django development. Unfortunately, the > metaclass mechanism which the main python library supporting this uses > conflicts with that of Django's metaclass for db.models. What happens > is that a metaclass and new methods are temporarily injected into the > model object while it acts as a role within a context. While it is an > instance of that role, we cannot use the save method on it. When the > role is removed the object may then be saved. Unfortunately that's > quite unsatisfactory and I'm wondering if Django's models can be a > little smarter when figuring out whether an object is a Django > db.model instance or not (we use multiple inheritance to retain the > db.model metaclass). Alternatively, can someone who gets more about > how the metaclass stuff is working with Django suggest a fix in the > roles module that would make it get along better with Django's ORM? > > roles can be found:http://pypi.python.org/pypi/roles/0.8 > the dci group (object composition) > is:http://groups.google.com/group/object-composition > > some example code showing how to make it all "work" with django > is:http://groups.google.com/group/object-composition/browse_thread/threa... > > DCI is a very exciting architecture to me that extends the object > model &MVC/T to a more logical end and addresses a lot of complex > issues in design. The concepts have significantly altered my approach > to designing new systems. I really want to be able to make this work > cleanly with Django if at all possible. Appreciate any insights. >
Hi Ben. Could you post the full error message AND traceback you get when trying to save your "roled" model instance please ? Django models have a '._meta' attribute which stores, well, metadata about the model, like fields, tablename etc, so the author's assumption (exposed in the thread on the 'object-composition' group) that the problem is caused by a class name change doesn't stand. I currently lack time to dig into this DCI thing and python-roles implementation but given enough context (=>traceback...) I might provide some hints. HTH -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.