Switch parent back to a ForeignKeyField without a constraint

This commit is contained in:
Jake Moshenko 2015-11-17 16:07:21 -05:00
parent 3374e8c812
commit e252397292
2 changed files with 12 additions and 6 deletions

View file

@ -227,7 +227,7 @@ def _find_or_link_image(existing_image, repo_obj, username, translations, prefer
comment=existing_image.comment,
v1_json_metadata=existing_image.v1_json_metadata,
aggregate_size=existing_image.aggregate_size,
parent_id=translated_parent_id,
parent=translated_parent_id,
v1_checksum=existing_image.v1_checksum)
@ -327,7 +327,7 @@ def set_image_metadata(docker_image_id, namespace_name, repository_name, created
if parent:
fetched.ancestors = '%s%s/' % (parent.ancestors, parent.id)
fetched.parent_id = parent.id
fetched.parent = parent
fetched.save()
return fetched
@ -429,10 +429,8 @@ def synthesize_v1_image(repo, image_storage, docker_image_id, created_date_str,
specified metadata.
"""
ancestors = '/'
parent_id = None
if parent_image is not None:
ancestors = '{0}{1}/'.format(parent_image.ancestors, parent_image.id)
parent_id = parent_image.id
created = None
if created_date_str is not None:
@ -444,7 +442,7 @@ def synthesize_v1_image(repo, image_storage, docker_image_id, created_date_str,
return Image.create(docker_image_id=docker_image_id, ancestors=ancestors, comment=comment,
command=command, v1_json_metadata=v1_json_metadata, created=created,
storage=image_storage, repository=repo, parent_id=parent_id)
storage=image_storage, repository=repo, parent=parent_image)
def ensure_image_locations(*names):