On Mon, Sep 27, 2010 at 5:46 PM, Luke Plant <l.plant...@cantab.net> wrote: > On Mon, 2010-09-27 at 11:36 +0200, Patryk Zawadzki wrote: >> With the risk of being ignored once again, I dare to link to a working >> solution that does not need any changed to the framework itself (other >> than perhaps including the factory class): >> >> http://gist.github.com/584106 > This looks rather good to me. It may have been ignored before because > it has no comments and some things are not immediately obvious. For > example, you are basically proposing that the concrete models are passed > into view functions via URLconf, and from there are passed into any > functions which need them, and so they would never actually need to be > imported by the app that defines the abstract model. > > I for one would be much happier to not add any more machinery via Meta > options. With some cleanup, and some documentation of this pattern, and > possibly a better name, I think the AbstractMixin class you propose > could be a good candidate for inclusion in core. > > Some notes: > 1) it seems like line 15 in abstract.py should say 'abstract':'False', > not 'True' - did I miss something?
It is there because I inherit from the .construct() result rather than taking it directly as a solid class. This helps with debugging as all the tracebacks show proper module for the model. > 2) there would need to be some way of merging the concrete class's own > Meta options with the abstract class's Meta options True. > 3) why do we need the _classcache? Is the key used specific enough - > what if two different apps both create 'MyCategory' based on > 'CategoryFactory', using them in different situations? I did it so there was no way to create two different mechanics for the same model accidentally. -- Patryk Zawadzki -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.