On Thu, Jul 30, 2009 at 5:55 AM, Russell
Keith-Magee<freakboy3...@gmail.com> wrote:
> Of course, Alex and I may have missed an obvious alternative solution
> - or a use case that isn't solved by either approach. Any feedback or
> alternative approaches we may have missed are most welcome.


It's been a while since I did anything with custom fields,
django.contrib.contenttypes.generic.GenericRelation has a reference to
the model it is attached to that is created in def
contribute_to_class(self, cls, name):. I am going to assume that in
the multi-db code the Model has a reference to the connection it is
supposed to use, so why not add the reference to model to the Field
class, then any time you need connection info you get it from the
parent model?

class Field(object):
    ...
    def contribute_to_class(self, cls, name):
        self.model = cls
        ...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to