Commit b059943e by Bodor Máté

Implement interface wrapper functions

parent 7d1687d5
......@@ -82,7 +82,9 @@ class Image(models.Model):
uploaded_by_user=False,
description=description
)
return new_image
for attr, value in new_image.__dict__.items():
setattr(remote_image, attr, value)
return remote_image
@classmethod
def create_from_user(cls, description, file_format, image_file, name, user):
......@@ -96,9 +98,24 @@ class Image(models.Model):
uploaded_by_user=True,
description=description
)
return new_image
for attr, value in new_image.__dict__.items():
setattr(remote_image, attr, value)
return remote_image
def delete(self):
interface = OpenstackImageManager(settings.CONNECTION)
if interface.delete(self.remote_id):
super().delete()
def get(self):
interface = OpenstackImageManager(settings.CONNECTION)
image = interface.get(self.remote_id)
for attr, value in self.__dict__.items():
setattr(image, attr, value)
return image
def update(self, data):
for (key, value) in data.items():
setattr(self, key, value)
self.save()
return self.get()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment