2015-02-18 6:34 GMT+01:00 Loïc Bistuer <loic.bist...@gmail.com>:

> Another option would be to make the signature `allow_migrate(self, db,
> app_label, model_name=None, **hints)` and to put the model class in the
> hints dict, the same way we pass `instance` as hint to the other routers.


Yes, that's what I wanted to suggest after Andrew confirmed my suspicion
that we have to account for historical models.

Perhaps the following convenience function can help factoring out the
arguments in the common case:

def allow_migrate_model(router, db, model):
    return router.allow_migrate(db, model._meta.app_label,
model._meta.model_name, model=model)

(This isn't a router method because there isn't a base class for routers.)

-- 
Aymeric.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CANE-7mVJpobigSdmEQt1NdkXOyjDWdPoEZJz4TVdVDeG9g%2BS2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to