I'd like to ask another question concerning plugin apps, and hoping your
deeper knowledge about Django internals helps here...

I'm implementing the plugin Metadata for GDAPS plugins ATM, and am a bit
concerned wether to implement a construct like the Pretix system or not.

Pretix uses AppConfig classes, and creates a inner PretixPluginMeta
classs where it sums up all the information it needs. It's easy then to 
walk all apps and filter out the ones that have a PretixPluginsMeta -
and get their data out.

class PaypalApp(PluginConfig):
    name = 'pretix_paypal'
    verbose_name = _("PayPal")

    class PretixPluginMeta:
        name = _("PayPal")
        author = _("the pretix team")
        version = '1.0.0'
        visible = True
        restricted = False
        description = _("This plugin allows you to receive payments via PayPal")
        compatibility = "pretix>=2.7.0"

What I need for a good plugin life cycle are methods, callbacks that are
called when a plugin is "installed" = run the first time, methods for
enabling/disabling etc.

The easiest way would be implementing these methods within the AppConfig
subclass.

I asked myself why is there a PluginMeta needed? Can't I add those data
attributes directly to AppConfig?

So my question on you all is: Is it a good idea to merge those data
deeply with tha AppConfig object? I mean, as a plugin in my sense is
more or less the same as an app, it won't matter. But deeply inside, I
feel that there is something wrong done. Separate concerns should not me
mixed - and I don't know what you want to implement in Django's future
into AppConfig. Maybe there could be conflicts.

Another way would be implementing the methods too into the PluginMeta
object.

May I ask for your opinions here?

And a second question: The DJango docs say, that it's not recommended to
use "default_app_config". But in each and every example, even in the
tutorials and the Django boilerplate code of "./manage.py startproject
foo" are NO Appconfigs addressed in INSTALLED_APPS. Nobody does this, right?

How "obligate" is this recommendation, when noone uses it? Should this
be kept?

Thanks,

Christian

-- 
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/78db174f-6e3d-1ca8-b7e4-b5218c4836b1%40nerdocs.at.
For more options, visit https://groups.google.com/d/optout.

Attachment: pEpkey.asc
Description: application/pgp-keys

Reply via email to