Skip to content

Commit

Permalink
Fixed pedantic import
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jul 30, 2019
1 parent eb0612e commit d692233
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/appier_extras/parts/export/part.py
Expand Up @@ -72,7 +72,7 @@ def routes(self):
]

@classmethod
@appier.link(name = "JSON (Global)", context = True)
@appier.link(name = "JSON (Export)", context = True)
def json_global(cls, view = None, context = None, absolute = False):
return appier.get_app().url_for(
"export.model_json",
Expand All @@ -83,7 +83,7 @@ def json_global(cls, view = None, context = None, absolute = False):
)

@classmethod
@appier.link(name = "ZIP (Global)", context = True)
@appier.link(name = "ZIP (Export)", context = True)
def zip_global(cls, view = None, context = None, absolute = False):
return appier.get_app().url_for(
"export.model_zip",
Expand All @@ -95,23 +95,24 @@ def zip_global(cls, view = None, context = None, absolute = False):

@classmethod
@appier.operation(
name = "Import JSON",
name = "Import JSON (Export)",
parameters = (
("JSON File", "file", "file"),
("Empty source", "empty", bool, False)
)
)
def import_json(cls, file, empty):
def callback(model_d):
if "_id" in model_d: del model_d["_id"]
model = cls(model_d)
model.save()
model.save(validate = False, verify = False)

if empty: cls.delete_c()
cls._json_import(file, callback)

@classmethod
@appier.operation(
name = "Import ZIP",
name = "Import ZIP (Export)",
parameters = (
("ZIP File", "file", "file"),
("Empty source", "empty", bool, False)
Expand Down

0 comments on commit d692233

Please sign in to comment.