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? #################### # two helper base classes class DBManager(models.Manager): def __init__(self, database=None, *args, **kwargs): super(DBManager, self).__init__(*args, **kwargs) if database: self._db = database class DBModel(models.Model): def __init__(self, *args, **kwargs): super(DBModel,self).__init__(*args,**kwargs) self._state = ModelState(self.__class__.objects.db) class Meta: abstract = True #################### # APP SPECIFIC DATABASE class MyModel(DBModel): objects = DBManager('my_database_name') # field definitions here This globally sets MyModel to use 'my_database_name'. There could also be a variation of DBManager that defaults to the app name. Thoughts? Bill -- 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.