@@ -1,19 +0,0 @@
|
|||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.utils.importlib import import_module
|
|
||||||
|
|
||||||
from .models import App
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
def register_apps():
|
|
||||||
for app_name in settings.INSTALLED_APPS:
|
|
||||||
logger.debug('registering: %s' % app_name)
|
|
||||||
App.register(app_name)
|
|
||||||
|
|
||||||
|
|
||||||
register_apps()
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
import logging
|
|
||||||
|
|
||||||
from django.db import models
|
|
||||||
from django.utils.importlib import import_module
|
|
||||||
|
|
||||||
from navigation.api import register_top_menu
|
|
||||||
from project_setup.api import register_setup
|
|
||||||
from project_tools.api import register_tool
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class App(object):
|
|
||||||
@classmethod
|
|
||||||
def register(cls, app_name):
|
|
||||||
logger.debug('Trying to import: %s' % app_name)
|
|
||||||
try:
|
|
||||||
app_module = import_module(app_name)
|
|
||||||
except ImportError:
|
|
||||||
logger.debug('Unable to import app: %s' % app_name)
|
|
||||||
else:
|
|
||||||
logger.debug('Trying to import registry from: %s' % app_name)
|
|
||||||
try:
|
|
||||||
registration = import_module('%s.registry' % app_name)
|
|
||||||
except ImportError as e:
|
|
||||||
logger.debug('Unable to import registry for app: %s; %s' % (app_name, e))
|
|
||||||
else:
|
|
||||||
if not getattr(registration, 'disabled', False):
|
|
||||||
app = App()
|
|
||||||
app.name = app_name
|
|
||||||
# If there are not error go ahead with the stored app instance
|
|
||||||
app.label = getattr(registration, 'label', app_name)
|
|
||||||
app.description = getattr(registration, 'description', u'')
|
|
||||||
|
|
||||||
for link in getattr(registration, 'setup_links', []):
|
|
||||||
logger.debug('setup link: %s' % link)
|
|
||||||
register_setup(link)
|
|
||||||
|
|
||||||
for link in getattr(registration, 'tool_links', []):
|
|
||||||
logger.debug('tool link: %s' % link)
|
|
||||||
register_tool(link)
|
|
||||||
|
|
||||||
for index, link in enumerate(getattr(registration, 'menu_links', [])):
|
|
||||||
logger.debug('menu_link: %s' % link)
|
|
||||||
register_top_menu(name='%s.%s' % (app_name, index), link=link)
|
|
||||||
|
|
||||||
def __unicode__(self):
|
|
||||||
return unicode(self.label)
|
|
||||||
@@ -2,9 +2,15 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from project_tools.api import register_tool
|
||||||
|
|
||||||
from .classes import APIEndPoint
|
from .classes import APIEndPoint
|
||||||
|
from .links import link_api, link_api_documentation
|
||||||
from .urls import api_urls
|
from .urls import api_urls
|
||||||
|
|
||||||
endpoint = APIEndPoint('rest_api')
|
endpoint = APIEndPoint('rest_api')
|
||||||
endpoint.register_urls(api_urls)
|
endpoint.register_urls(api_urls)
|
||||||
endpoint.add_endpoint('auth_token_obtain', _(u'Obtain an API authentication token.'))
|
endpoint.add_endpoint('auth_token_obtain', _(u'Obtain an API authentication token.'))
|
||||||
|
|
||||||
|
register_tool(link_api)
|
||||||
|
register_tool(link_api_documentation)
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
from .links import link_api, link_api_documentation
|
|
||||||
|
|
||||||
tool_links = [link_api, link_api_documentation]
|
|
||||||
@@ -2,9 +2,13 @@ from __future__ import absolute_import
|
|||||||
|
|
||||||
from navigation.api import register_links
|
from navigation.api import register_links
|
||||||
|
|
||||||
|
from project_tools.api import register_tool
|
||||||
|
|
||||||
from .classes import Statistic, StatisticNamespace
|
from .classes import Statistic, StatisticNamespace
|
||||||
from .links import link_execute, link_namespace_details, link_namespace_list
|
from .links import (link_execute, link_namespace_details, link_namespace_list,
|
||||||
|
link_statistics)
|
||||||
|
|
||||||
register_links(StatisticNamespace, [link_namespace_details])
|
register_links(StatisticNamespace, [link_namespace_details])
|
||||||
register_links([StatisticNamespace, 'statistics:namespace_list', 'statistics:execute'], [link_namespace_list], menu_name='secondary_menu')
|
register_links([StatisticNamespace, 'statistics:namespace_list', 'statistics:execute'], [link_namespace_list], menu_name='secondary_menu')
|
||||||
register_links(Statistic, [link_execute])
|
register_links(Statistic, [link_execute])
|
||||||
|
register_tool(link_statistics)
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
from __future__ import absolute_import
|
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy as _
|
|
||||||
|
|
||||||
from .links import link_statistics
|
|
||||||
|
|
||||||
label = _(u'Statistics')
|
|
||||||
description = _(u'Central place to store and display app statistics.')
|
|
||||||
tool_links = [link_statistics]
|
|
||||||
@@ -72,7 +72,6 @@ INSTALLED_APPS = (
|
|||||||
'smart_settings',
|
'smart_settings',
|
||||||
'user_management',
|
'user_management',
|
||||||
# Mayan EDMS
|
# Mayan EDMS
|
||||||
'app_registry',
|
|
||||||
'checkouts',
|
'checkouts',
|
||||||
'document_acls',
|
'document_acls',
|
||||||
'document_comments',
|
'document_comments',
|
||||||
|
|||||||
Reference in New Issue
Block a user