1. Adam Knight
  2. milton

Source

milton / drupal_support / routers.py

from models import *

class DrupalRouter(object):
    """
    A router to use the "drupal" database for Drupal objects, if it exists.
    """
    def db_for_read(self, model, **hints):
        if model._meta.app_label == 'drupal_support':
            return 'drupal'
        return None
    
    def db_for_write(self, model, **hints):
        if model._meta.app_label == 'drupal_support':
            return 'drupal'
        return None
    
    def allow_relation(self, obj1, obj2, **hints):
        """
        If either model is in this app but both are not, reject.
        """
        if obj1._meta.app_label == 'drupal_support' or \
            obj2._meta.app_label == 'drupal_support':
            if obj1._meta.app_label == obj2._meta.app_label:
                return True
            else:
                return False
        return None
    
    def allow_syncdb(self, db, model):
        if db == 'drupal' or model._meta.app_label == 'sitepoet.drupal_support':
            print "DENY"
            return False
        print "NO OPINION"
        return None