Initial registry updates for the metadata app
This commit is contained in:
@@ -3,8 +3,6 @@ from __future__ import absolute_import
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from acls.api import class_permissions
|
||||
#from backups.api import AppBackup, ModelBackup
|
||||
#from app_registry import register_app, UnableToRegister
|
||||
from common.utils import encapsulate
|
||||
from documents.models import Document, DocumentType
|
||||
from navigation.api import (bind_links, register_sidebar_template,
|
||||
@@ -57,11 +55,3 @@ register_model_list_columns(Document, [
|
||||
encapsulate(lambda x: get_metadata_string(x))
|
||||
},
|
||||
])
|
||||
|
||||
|
||||
#try:
|
||||
# app = register_app('metadata', _(u'Metadata'))
|
||||
#except UnableToRegister:
|
||||
# pass
|
||||
#else:
|
||||
#a AppBackup(app, [ModelBackup()])
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
"""Configuration options for the metadata app"""
|
||||
|
||||
import datetime
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from smart_settings.api import Setting, SettingNamespace
|
||||
|
||||
default_available_functions = {
|
||||
'current_date': datetime.datetime.now().date,
|
||||
}
|
||||
|
||||
default_available_models = {
|
||||
'User': User
|
||||
}
|
||||
|
||||
namespace = SettingNamespace('metadata', _(u'Metadata'), module='metadata.conf.settings', sprite='xhtml')
|
||||
|
||||
Setting(
|
||||
namespace=namespace,
|
||||
name=u'AVAILABLE_FUNCTIONS',
|
||||
global_name=u'METADATA_AVAILABLE_FUNCTIONS',
|
||||
default=default_available_functions,
|
||||
)
|
||||
|
||||
Setting(
|
||||
namespace=namespace,
|
||||
name=u'AVAILABLE_MODELS',
|
||||
global_name=u'METADATA_AVAILABLE_MODELS',
|
||||
default=default_available_models,
|
||||
)
|
||||
@@ -6,7 +6,7 @@ from django.forms.formsets import formset_factory
|
||||
|
||||
from common.widgets import ScrollableCheckboxSelectMultiple
|
||||
|
||||
from .conf.settings import AVAILABLE_MODELS, AVAILABLE_FUNCTIONS
|
||||
#from .conf.settings import AVAILABLE_MODELS, AVAILABLE_FUNCTIONS
|
||||
from .models import MetadataSet, MetadataType, DocumentTypeDefaults
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from documents.models import Document, DocumentType
|
||||
|
||||
from .conf.settings import (AVAILABLE_MODELS, AVAILABLE_FUNCTIONS)
|
||||
#from .settings import (AVAILABLE_MODELS, AVAILABLE_FUNCTIONS)
|
||||
|
||||
available_models_string = (_(u' Available models: %s') % u','.join([name for name, model in AVAILABLE_MODELS.items()])) if AVAILABLE_MODELS else u''
|
||||
available_functions_string = (_(u' Available functions: %s') % u','.join([u'%s()' % name for name, function in AVAILABLE_FUNCTIONS.items()])) if AVAILABLE_FUNCTIONS else u''
|
||||
|
||||
34
apps/metadata/registry.py
Normal file
34
apps/metadata/registry.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
default_available_functions = {
|
||||
'current_date': datetime.datetime.now().date,
|
||||
}
|
||||
|
||||
default_available_models = {
|
||||
'User': User
|
||||
}
|
||||
|
||||
#from .icons import icon_history_list
|
||||
#from .links import history_list
|
||||
|
||||
label = _(u'Metadata')
|
||||
#description = _(u'Handles the events registration and event logging.')
|
||||
dependencies = ['app_registry', 'icons', 'navigation', 'documents', 'permissions', 'acls', 'common']
|
||||
#icon = icon_history_list
|
||||
#tool_links = [history_list]
|
||||
"""
|
||||
app.add_setting(
|
||||
name=u'AVAILABLE_FUNCTIONS',
|
||||
default=default_available_functions,
|
||||
)
|
||||
|
||||
app.add_setting(
|
||||
name=u'AVAILABLE_MODELS',
|
||||
default=default_available_models,
|
||||
)
|
||||
"""
|
||||
Reference in New Issue
Block a user