def add_version_log_for_blocked_versions(obj, al): from olympia.activity.models import VersionLog VersionLog.objects.bulk_create([ VersionLog(activity_log=al, version_id=version.id) for version in obj.addon_versions if obj.is_version_blocked(version.version) ])
def add_version_log_for_blocked_versions(obj, al): from olympia.activity.models import VersionLog VersionLog.objects.bulk_create([ VersionLog(activity_log=al, version_id=id_) for version, (id_, _) in obj.addon_versions.items() if obj.is_version_blocked(version) ])
def add_versionlog(items, **kw): log.info('[%s@%s] Adding VersionLog starting with ActivityLog: %s' % (len(items), add_versionlog.rate_limit, items[0])) for al in ActivityLog.objects.filter(pk__in=items): # Delete existing entries: VersionLog.objects.filter(activity_log=al).delete() for a in al.arguments: if isinstance(a, Version): vl = VersionLog(version=a, activity_log=al) vl.save() # We need to save it twice to backdate the created date. vl.created = al.created vl.save()