Hi Russell, regarding that doc page,
there's a typo, please remove that hanging "admin.site.register": class PublisherAdmin(MultiDBModelAdmin): inlines = [BookInline] admin.site.register On Mon, Jan 25, 2010 at 5:53 PM, Russell Keith-Magee <freakboy3...@gmail.com> wrote: > On Mon, Jan 25, 2010 at 7:31 PM, Bill Hubauer <bhuba...@gmail.com> wrote: >> >> >> Hi all, >> >> Given the new multi-db implementation, I put together a couple of little >> "helper" classes to make app specific, or model specific databases really >> easy. >> >> Please consider the following and let me know if you think this is too >> abusive of the internals of the multi-db implementation. Any gotchas? > > This approach should work, but there is a better way. > > As of r12272 (committed about three days ago), the best approach to > this problem is to define a database router that directs queries on a > particular object type to a specific database. The documentation [1] > gives a specific example of how to do this. > > The advantage to using this technique instead of overriding the > manager is that it allows you to decouple database use from model > definition. As the example in the documentation demonstrates, you can > use a router to direct queries on auth.User to a different database > without the need to make any changes to the User class itself, or to > any queries touching the User class. > > [1] > http://docs.djangoproject.com/en/dev/topics/db/multi-db/#automatic-database-routing > > 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 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. > > -- Best regards, Yuri V. Baburov, ICQ# 99934676, Skype: yuri.baburov, MSN: bu...@live.com -- 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.