From 910d8135ed724b9ce434d99fa10708777f76f924 Mon Sep 17 00:00:00 2001 From: WalterDa Date: Fri, 5 Jan 2018 17:08:20 +0100 Subject: [PATCH 1/2] Update models for admin compatibility Using as a reference the method provided in https://github.com/TurboGears/tgext.pluggable/issues/13, to achieve compatibility with the admin panel all pluggables' models need to list the model classes they want to expose in the admin panel through `__all__`. Using inspection on the module should work as well, but this seems to me a cleaner (and more "pythonic") solution, even if it requires fixing all pluggables that don't already implement `__all__` in their models --- registration/model/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/registration/model/__init__.py b/registration/model/__init__.py index 2fd62ae..ab1f7ad 100644 --- a/registration/model/__init__.py +++ b/registration/model/__init__.py @@ -2,6 +2,8 @@ from tg import config from tgext.pluggable import PluggableSession +__all__ = ["Registration"] + DBSession = PluggableSession() Registration = None From 0de4fe132ecadc85b7891699a67f0c750544c50b Mon Sep 17 00:00:00 2001 From: WalterDa Date: Fri, 5 Jan 2018 18:02:35 +0100 Subject: [PATCH 2/2] Update ming_models.py --- registration/model/ming_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/registration/model/ming_models.py b/registration/model/ming_models.py index 26c6f3e..f7d0275 100644 --- a/registration/model/ming_models.py +++ b/registration/model/ming_models.py @@ -29,7 +29,7 @@ class __mongometa__: password = FieldProperty(s.String, required=True) code = FieldProperty(s.String) activated = FieldProperty(s.DateTime) - extras = FieldProperty(s.Anything) + extras = FieldProperty(s.Anything, if_missing=None) user_id = ForeignIdProperty(app_model.User)