Skip to content

Instantly share code, notes, and snippets.

@wilig
Created October 26, 2010 20:17
Show Gist options
  • Save wilig/647702 to your computer and use it in GitHub Desktop.
Save wilig/647702 to your computer and use it in GitHub Desktop.
@classmethod
def create_from_dict(cls, project, profile_id, data_dict, asset_group=None):
"""Takes a dict with field_definition ids mapped to values and returns a new asset"""
asset = Asset(profile_id)
asset.update_from_dict(data_dict)
asset.project = project
# for fd in project.field_definitions:
# if fd.id in data_dict.keys():
# asset.set_field_value(fd, data_dict[fd.id])
return asset
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment