Re: Adding support for importing models through the app registry while it is loading

2016-09-30 Thread Aymeric Augustin
Hello, Quick follow-up: I just updated my PR according to this discussion: https://github.com/django/django/pull/6547 While I was there, I made get_user_model() usable at import time. We’ll need feedback from actual projects to know it that works. -- Aymeric. -- You received this message

Re: Adding support for importing models through the app registry while it is loading

2016-09-06 Thread Carl Meyer
On 09/06/2016 12:55 PM, Aymeric Augustin wrote: > Hi Carl, > > Thanks for the feedback! Of course! Thanks for working on things :-) > ... > The change I’m proposing doesn’t introduce random bugs. If models are > missing reverse relations, that will be deterministic. +1 >> Is it possible >> to

Re: Adding support for importing models through the app registry while it is loading

2016-09-06 Thread Aymeric Augustin
Hi Carl, Thanks for the feedback! > On 06 Sep 2016, at 19:39, Carl Meyer wrote: > > 1) A kwarg to `get_model` seems fine, but I don't like the vague FUD of > `unsafe=True` (if it's really "not safe" we shouldn't add it / make it > public at all). How about something more

Re: Adding support for importing models through the app registry while it is loading

2016-09-06 Thread Carl Meyer
Hi Aymeric, On 09/04/2016 01:03 PM, Aymeric Augustin wrote: > Hello, > > Since Django 1.7, `get_user_model()` cannot be called at import time. > Django contains a lot of methods that start with `UserModel = > get_user_model()` while it would be more natural to declare it as a > global variable

Adding support for importing models through the app registry while it is loading

2016-09-04 Thread Aymeric Augustin
Hello, Since Django 1.7, `get_user_model()` cannot be called at import time. Django contains a lot of methods that start with `UserModel = get_user_model()` while it would be more natural to declare it as a global variable in the module. This trips up users and the reason why it’s forbidden