Re: mutual imports - how to do it?
2011/4/18 Kenneth Gonsalves <lawgon@thenilgiris.com>:
> hi,
>
> I have two models.py files in two applications. Say, products.models and
> incident.models.
>
> In incident I can do: from products.models import Product
> but in products if I do:
> from incident.import Something - this fails and django says cannot
> import Something.
>
> Is there any way around this?
from django.db.models import get_model
Product = get_model('products', 'Product')
Something = get_model('incident', 'Something')
Regards,
--
Fabián E. Gallina
http://www.anue.biz
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home