Hey Aymeric, hey all,

it took a little longer than I hoped but I eventually managed to put
together a few questions that came up while porting a pluggable app to
Django 1.7 with backward-compatibility through to 1.4. I hope all of
these make sense and I am looking forward to the feedback:

1) Creating a subclass of AppConfig for a Django app is (according to
the docs) not required. If none is defined, Django falls back to AppConfig.

For a pluggable app, is it recommended to always subclass AppConfig and
provide default_app_config?

2) The recommended way to register signals with receivers now (assuming
they should be registered automatically) is the ready() method.
Previously, the only "safe" way to ensure they would be connected was
doing that in the 'models.py'.

For a pluggable app this can be tricky if you are trying to maintain
backward-compatability. The only way I can think of is checking in the
'models.py' for a Django version < 1.7 and only run the code then. Is
there another/better way to do that?

3) Across several pluggable apps that I've worked on, there have been
several occasions where a model from one app is imported into the
'models.py' of another app. Now this causes issues with the new
AppConfig if I call 'get_model' at the module level. The only way I see
around it is to pull 'get_model' into that function(s) where this model
is used...which seems bad. An example would be here [1]. It might not be
the best example but one that I've come across just a few days ago.

Is there a better way to deal with this when using the AppConfig? Or
should that be avoided in general to import model in another apps'
'models.py'.

4) A project that I am working with is django-oscar [2] which defines an
'app.py' which contains a subclass of 'Application' (e.g. [3]). The main
purpose is to provide an overridable way to define URL pattners by
providing them through a 'get_urls' method.

It seems intuitive to me to consolidate functionality like that into the
AppConfig subclass for an app. Are there any reasons for or against
doing this? Are there any implications this might have on the loading of
the app registry?

Thanks for any thoughts and advice on this. And thanks for the great new
appregistry, it's a pleasure to work with.

Cheers,
Sebastian

PS: @Florian, thanks for the PGP/Mime hint. I hope it looks better this
time :)

[1]
https://github.com/tangentlabs/django-fancypages/blob/issue/33/support_for_django17/fancypages/models/blocks/content.py#L127
[2] https://github.com/tangentlabs/django-oscar
[3]
https://github.com/tangentlabs/django-oscar/blob/master/oscar/apps/basket/app.py

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to