self._classes[cls] = (create_dashboard, delete_dashboard) _dashboard_registry = _DashboardRegistry() def manage_dashboard(cls, default_title=_("Dashboard")): """Connects handlers for dashboard management. This handler could be used to automatically create a related dashboard on given model class instance creation. i.e.: >> manage_dashboard(Project, _("Project's dashboard")) It will auto generate a dashboard associated to each new Project's instance with title "Project's dashboard". If no title is passed, default title will be used ("Dashboard"). """ cls = get_model(cls) global _dashboard_registry _dashboard_registry.manage_dashboard(cls, default_title) ## CONNECTIONS ## manage_author_permissions(Region) manage_author_permissions(Plugget) manage_dashboard(settings.AUTH_USER_MODEL, _('My dashboard'))
except Region.DoesNotExist: pass self._classes[cls] = (create_dashboard, delete_dashboard) _dashboard_registry = _DashboardRegistry() def manage_dashboard(cls, default_title=_("Dashboard")): """Connects handlers for dashboard management. This handler could be used to automatically create a related dashboard on given model class instance creation. i.e.: >> manage_dashboard(Project, _("Project's dashboard")) It will auto generate a dashboard associated to each new Project's instance with title "Project's dashboard". If no title is passed, default title will be used ("Dashboard"). """ cls = get_model(cls) global _dashboard_registry _dashboard_registry.manage_dashboard(cls, default_title) ## CONNECTIONS ## manage_author_permissions(Region) manage_author_permissions(Plugget) manage_dashboard(settings.AUTH_USER_MODEL, _('My dashboard'))
on given model class instance creation. i.e.: >> manage_bookmarks(User) It will auto generate a bookmark list associated to each new User's instance. To disconnect: >> manage_bookmarks(User, False) """ cls = get_model(cls) cls_name = cls.__name__.lower() create_dispatch_uid = "create_%s_bookmarks" % cls_name delete_dispatch_uid = "delete_%s_bookmarks" % cls_name if enabled: post_save.connect(_create_bookmarks, cls, dispatch_uid=create_dispatch_uid) pre_delete.connect(_delete_bookmarks, cls, dispatch_uid=delete_dispatch_uid) else: post_save.disconnect(_create_bookmarks, cls, dispatch_uid=create_dispatch_uid) pre_delete.disconnect(_delete_bookmarks, cls, dispatch_uid=delete_dispatch_uid) ## CONNECTIONS ## manage_author_permissions(Menu) manage_author_permissions(Link) manage_author_permissions(Bookmark) manage_bookmarks(settings.AUTH_USER_MODEL)