#x27;db2')
Wei guangjing
- Original Message -
From: "wei guangjing"
To:
Sent: Sunday, December 28, 2008 12:00 PM
Subject: Re: Multi Database use with statement
> Please see the attached patch for using in models's Meta option, I also like
> this option.
>
&
On Dec 27, 2008, at 12:23, wei guangjing wrote:
> from __future__ import with_statement
> from django.contrib.auth.models import User
> from django.db import using
>
> with using('db1'):
>print User.objects.count() # db1 user count
>with using('db2'):
>print User.objects.count() #
e use special db connection:
enter_connection_management(connection)
leave_connection_management()
Wei guangjing
- Original Message -
From: "mtrier"
To: "Django developers"
Sent: Sunday, December 28, 2008 10:37 AM
Subject: Re: Multi Database use with statement
Hi
Personally I think I like Michael's suggestion of a using method on a
queryset, and a default in Meta(pretty much the way ordering works).
To his question of reusable applications I think the solution to that
is actually something outside the scope of Django itself, a reusable's
apps views should
Hi Wei,
On Dec 27, 6:23 am, "wei guangjing" wrote:
> Hi,
>
> I write a patch for using with statement in python 2.5 and up for multi
> database access, example code like this:
>
> # test.py
> from __future__ import with_statement
> from django.contrib.auth.models import User
> from django.db im
Hi,
I write a patch for using with statement in python 2.5 and up for multi
database access, example code like this:
# test.py
from __future__ import with_statement
from django.contrib.auth.models import User
from django.db import using
with using('db1'):
print User.objects.count() # db1 us