Merge "Use plural for class_definition"
This commit is contained in:
commit
c04cad9a3c
@ -28,7 +28,7 @@ PKG_PARAMS_MAP = {'display_name': 'name',
|
||||
'package_type': 'type',
|
||||
'description': 'description',
|
||||
'author': 'author',
|
||||
'classes': 'class_definition'}
|
||||
'classes': 'class_definitions'}
|
||||
|
||||
|
||||
def get_draft(environment_id=None, session_id=None):
|
||||
|
@ -280,7 +280,7 @@ def package_search(filters, context):
|
||||
if 'search' in filters.keys():
|
||||
fk_fields = {'categories': 'Category',
|
||||
'tags': 'Tag',
|
||||
'class_definition': 'Class'}
|
||||
'class_definitions': 'Class'}
|
||||
conditions = []
|
||||
|
||||
for attr in dir(pkg):
|
||||
@ -357,7 +357,7 @@ def package_upload(values, tenant_id):
|
||||
|
||||
composite_attr_to_func = {'categories': _get_categories,
|
||||
'tags': _get_tags,
|
||||
'class_definition': _get_class_definitions}
|
||||
'class_definitions': _get_class_definitions}
|
||||
with session.begin():
|
||||
for attr, func in composite_attr_to_func.iteritems():
|
||||
if values.get(attr):
|
||||
|
@ -281,7 +281,8 @@ class Package(BASE, ModificationsTrackedObject):
|
||||
secondary=package_to_category,
|
||||
cascade='save-update, merge',
|
||||
lazy='joined')
|
||||
class_definition = sa_orm.relationship("Class", lazy='joined')
|
||||
class_definitions = sa_orm.relationship(
|
||||
"Class", cascade='save-update, merge, delete', lazy='joined')
|
||||
|
||||
def to_dict(self):
|
||||
d = self.__dict__.copy()
|
||||
@ -289,7 +290,7 @@ class Package(BASE, ModificationsTrackedObject):
|
||||
'archive',
|
||||
'logo',
|
||||
'ui_definition']
|
||||
nested_objects = ['categories', 'tags', 'class_definition']
|
||||
nested_objects = ['categories', 'tags', 'class_definitions']
|
||||
for key in not_serializable:
|
||||
if key in d.keys():
|
||||
del d[key]
|
||||
|
Loading…
Reference in New Issue
Block a user