Well, if you were looking to do so in 1.6 for the scores of suffering developers _now_... what would you do?
On 22 December 2013 19:55, charettes <charett...@gmail.com> wrote: > Since Django 1.7 you can lazily reference model signal sender, it might > help solving your circular import issues. > > It seems providing a reliable initialization signal is one of Aymeric's > main goal. > > Simon > > Le dimanche 22 décembre 2013 03:22:29 UTC-5, Curtis Maloney a écrit : > >> Reading the posts on App reconfigure reminded me I wanted to raise this >> for discussion. >> >> Recently we've been suffering circular imports, and the majority are, >> IMHO, caused by people importing "receivers" in the apss __init__.py. >> >> By convention [in our app, at least] "receivers.py" registers all the >> signal receivers. >> >> However, as Aymeric points out, puttng code in __init__ is a prime >> candidate for triggering circular imports. >> >> A lot of times we can avoid the problems by breaking the loops with >> get_model(), however it generally gets applied elsewhere. We can't always >> do this in models.py, because often that would require importing other >> models, and I avoid that as much as possible. >> >> So I tried an autodiscover mechanism, just admin, to make it clean, clear >> and obvious as to when all the receivers were hooked. >> >> But... >> >> When to run it? >> >> If I put it in urls.py, like admin.autodiscover, can I be sure it will be >> triggered for, say, my celery tasks? Or management commands? I could put >> it at the end of settings.py, but that just feels wrong. >> >> I'm happy to trace the whole of Django from go to whoa, and decide on a >> place to put it, but I'd like to hear from the community in general for >> ideas. >> >> -- >> Curtis >> >> -- > You received this message because you are subscribed to the Google Groups > "Django developers" 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 firstname.lastname@example.org. > 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/643a1e10-f4c8-4a90-a96e-17620e7c9843%40googlegroups.com > . > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "Django developers" 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 email@example.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/CAG_XiSATSiajDZSU5JmDdDnGy4QFYBq7nwffU23Kz3nX2vF8%3Dw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.