Has this code been merged to a 1.2 alpha build somewhere or is the
multi-db branch still the current release?  Only asking because the
first message in the thread indicated a schedule which meant the code
would be merged in before EOY and I just want to make sure I'm on the
right codebase moving forward :)

Thanks,
Joe

On Dec 23 2009, 4:04 am, Russell Keith-Magee <[email protected]>
wrote:
> On Wed, Dec 23, 2009 at 1:32 PM, Michael Manfre <[email protected]> wrote:
> > With multiple database defined, what is the expected behavior for
> > syncdb and the otherdbrelated commands?
>
> The management commands all work the same way under multidb - they
> only ever work on a single database at a time. If you don't specify a
> database, the 'default' databse is used.
>
> > The documentation shows that
> > it is relatively easy to associate an admin form with a given
> > database, but is there a way of associated a model or app to a given
> > database?
>
> Yes - ish. If you're working with your own application and models,
> just define a custom manager for that model. The manager just needs to
> override get_query_set() and applies a using() modifier:
>
> class PersonManager(models.Manager):
>     def get_query_set(self):
>         return super(PersonManager, self).get_query_set().using('other')
>
> class Person(models.Model):
>     objects = PersonManager()
>     name = models.CharField(max_length=50)
>     ...
>
> Unfortunately, this approach doesn't work for a model in a reusable
> app - for example, you can't easily push contrib.auth.User to a
> different database. However, you can just call
> User.objects.using('other').... whenever you want to use the User
> model.
>
> I know this is less than ideal, but the goal for 1.2 was to complete
> the plumbing and get the important porcelain in place (e.g., using()).
> The goal for 1.3 is to identify the common end-user use cases for
> multidb and make some easily exploitable hooks for end-users.
>
> Yours,
> Russ Magee %-)

--

You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.


Reply via email to