Skip to content

Instantly share code, notes, and snippets.

@andymckay
Created December 7, 2011 23:04
Show Gist options
  • Save andymckay/1445190 to your computer and use it in GitHub Desktop.
Save andymckay/1445190 to your computer and use it in GitHub Desktop.
import amo
from addons.models import Addon
# Guids to update from builder.
guids = []
# Builder version to set.
id = ''
def run():
for guid in guids:
try:
addon = Addon.objects.get(pk=guid, auto_repackage=True,
disabled_by_user=False,
status__in=amo.VALID_STATUSES)
except Addon.DoesNotExist:
print 'Addon with guid %s does not exist' % guid
continue
file_ = addon.current_version.order_by('-pk')[0]
file_.update(builder_version=id)
print 'Updating file %s for addon %s' % (file_.pk, guid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment