Yes. I know how django works with dynamic models and this make me sad.

Yes, i know workflow of AppConfigs init. It set models_ready and ready 
booleans and call AppConfig.ready() then.

I really can't understand why AppConfig.ready() is calling multiple times. 
This is strange. But this can be fixed by some AppConfig state attribute. 
(like self.dynamic_models_ready). Anyway my models is unmanaged and can't(i 
hope) be affected.

May be AppConfig class should have models_ready() method for overwriting. 
It will be called after setting app models. Actually i can realize this in 
Django but not sure about neediness...

среда, 19 октября 2016 г., 14:28:15 UTC+3 пользователь Jani Tiainen написал:
>
> Well problem with Django is that there is not really support for "dynamic 
> models".
>
> Django expects that _before_ calling ready() all models are registered and 
> ready for use.
>
> Also note that ready() maybe called multiple times. You should take into 
> account that for example when running unit tests Django changes database 
> connection, which may affect your model construction.
>
> On 19.10.2016 12:22, Vlasov Vitaly wrote:
>
> Hello.
>
> I have working model factory of dynamic models in my app.models.py. I 
> need to know where i should call it in my code. Right now i call it in 
> MyAppConfig ready() method and think it is not right way. But this is 
> working.
> Where i should place dynamic models factory call?
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com <javascript:>.
> To post to this group, send email to django...@googlegroups.com 
> <javascript:>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/492d62ac-5dd4-4553-a4e9-66798f51a131%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/django-users/492d62ac-5dd4-4553-a4e9-66798f51a131%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b9a8d38a-96d0-42c5-915e-51f00d51a887%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to