-
-
djblets/extensions/base.py (Diff revision 1) I don't know that I agree that is_configurable must be set. I can imagine extensions that don't need any configuration to do anything, and thus won't need to present a config UI to the user, but an administration UI may be useful for tweaking stored data or performing extra queries, or just debugging.
-
-
-
-
-
djblets/extensions/base.py (Diff revision 1) Comments should always be in sentence format. Casing and period.
-
djblets/extensions/base.py (Diff revision 1) You only use this in the exception case, so you probably don't want to import it yet.
-
djblets/extensions/base.py (Diff revision 1) I don't know that I'd bubble up an ImportError. That can be caused by any number of things. Rather, this is a configuration error. Django's ImproperlyConfigured error, with message text clearly explaining the problem, would be more appropriate.
Added support for extension admin sites
Review Request #2888 — Created Feb. 16, 2012 and submitted
This adds support for extensions to have their own admin site by setting extension.has_admin_site = True. In order to add an admin site to an extension, the following steps must be taken: 1. extension.has_admin_site = True 2. Models registered in admin.py - ex: extension_manager = get_extension_manager() extension = extension_manager.get_enabled_extension(ExtensionClassName.id) extension.admin_site.register(ModelName, ModelAdminName) The admin site will be generated and a link Database link will appear on the extension list. Currently there is a bug due to interaction between action logs from the main admin site, and the extension admin sites. Since the models for Review Board are not registered with the extension admin site, and vice versa, clicking a recent action on the admin site page which originated from the other admin site will link to an invalid url. This is a django bug, and I have filed an issue: https://code.djangoproject.com/ticket/17726
Tested by creating admin site for rbwebhooks extension.
Description | From | Last Updated |
---|---|---|
I don't know that I agree that is_configurable must be set. I can imagine extensions that don't need any configuration … |
chipx86 | |
Blank line between these. |
chipx86 | |
"Creates" |
chipx86 | |
Period after "admin site." |
chipx86 | |
Period at the end. |
chipx86 | |
Comments should always be in sentence format. Casing and period. |
chipx86 | |
You only use this in the exception case, so you probably don't want to import it yet. |
chipx86 | |
I don't know that I'd bubble up an ImportError. That can be caused by any number of things. Rather, this … |
chipx86 | |
You don't need this. It's implicit. |
chipx86 | |
Do we want to catch everything here? Seems like it's misleading to eventually raise an ImportError if this is, say, … |
chipx86 | |
Blank line between these. |
chipx86 | |
Hm...so, if I understand this correctly, if I've set up my Extension incorrectly, and had has_admin_site set to true, but … |
mike_conley |
Change Summary:
Updated so that admin sites can be created with is_configurable = False. Fixed a bug where models were not being re-registered when the extensions was disabled and then re-enabled. Updated description to reflect changes.
Description: |
|
||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+79 -15) |
Change Summary:
Updated description to fix link
Description: |
|
---|
-
Hey Steven, The code looks fine to me - just one question and a possible issue below. Thanks, -Mike
-
djblets/extensions/base.py (Diff revision 2) Just curious, why did we remove the conditional checking if urlconf has the attribute "urlpatterns"?
-
djblets/extensions/base.py (Diff revision 2) Hm...so, if I understand this correctly, if I've set up my Extension incorrectly, and had has_admin_site set to true, but I don't have an admin module...the error gets swallowed? I'm not sure I agree with that. Is there a good reason?
-
-
-
djblets/extensions/base.py (Diff revision 2) Do we want to catch everything here? Seems like it's misleading to eventually raise an ImportError if this is, say, a SyntaxError or something else. I'd rather we catch ImportError and let other things fall through.
-