Hi Curtis,
On 12/21/2015 06:52 AM, Curtis wrote:
> Whilst I'm awake... a pull request I made to a 3rd party project
> included replacing explicit model imports for relation fields with lazy
> binding -- ForeignKey('contenttypes.ContentType') in this case.
>
> The author pointed out this didn't play well with their IDEs refactoring
> tool, and asked if there was a general discussion on why lazy references
> were better.
>
> So aside from the obvious "preventing circular imports", what other
> benefits do people see?I consider string FK references to be an ugly wart, to be used only when using regular imports is impossible (that is, only in circular reference situations). > I'm quite sure I was driven to that PR because importing ContentTypes > was causing lots of pain with AppState not being ready. Hard to say exactly what would be causing that without seeing the specific case, but it should be resolvable without resorting to string references. "Fixing" app-registry-not-ready by using string FK references would feel to me like papering over the problem, instead of finding the root cause and fixing it. Carl -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/56783E8F.4010808%40oddbird.net. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature
