Skip to content

Instantly share code, notes, and snippets.

@jdunne-kaplan
Created March 18, 2015 16:56
Show Gist options
  • Save jdunne-kaplan/7563b06e89f6e1fe43d8 to your computer and use it in GitHub Desktop.
Save jdunne-kaplan/7563b06e89f6e1fe43d8 to your computer and use it in GitHub Desktop.
Add deck_id to slidedecks asset
import json
import models
from google.appengine.ext import ndb
opaqueID = '9f3cccbe-ee94-4bd6-9ba6-96efb1967ae4'
deck_asset = models.DBAsset.all().filter('opaqueID = ', opaqueID).filter('assetType = ', 'slidedecks').get()
asset = json.loads(deck_asset.asset)
# Add new deck_id:
asset["deck_ids"].append("4abd5f17-dd8b-42ec-a5e8-d9fecbeebdf9")
deck_asset.asset = json.dumps(asset)
# Update deck asset:
deck_asset.put()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment