Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
11
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
b059943e
authored
Jul 23, 2019
by
Bodor Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement interface wrapper functions
parent
7d1687d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
recircle/image/models.py
+20
-2
No files found.
recircle/image/models.py
View file @
b059943e
...
@@ -82,7 +82,9 @@ class Image(models.Model):
...
@@ -82,7 +82,9 @@ class Image(models.Model):
uploaded_by_user
=
False
,
uploaded_by_user
=
False
,
description
=
description
description
=
description
)
)
return
new_image
for
attr
,
value
in
new_image
.
__dict__
.
items
():
setattr
(
remote_image
,
attr
,
value
)
return
remote_image
@classmethod
@classmethod
def
create_from_user
(
cls
,
description
,
file_format
,
image_file
,
name
,
user
):
def
create_from_user
(
cls
,
description
,
file_format
,
image_file
,
name
,
user
):
...
@@ -96,9 +98,24 @@ class Image(models.Model):
...
@@ -96,9 +98,24 @@ class Image(models.Model):
uploaded_by_user
=
True
,
uploaded_by_user
=
True
,
description
=
description
description
=
description
)
)
return
new_image
for
attr
,
value
in
new_image
.
__dict__
.
items
():
setattr
(
remote_image
,
attr
,
value
)
return
remote_image
def
delete
(
self
):
def
delete
(
self
):
interface
=
OpenstackImageManager
(
settings
.
CONNECTION
)
interface
=
OpenstackImageManager
(
settings
.
CONNECTION
)
if
interface
.
delete
(
self
.
remote_id
):
if
interface
.
delete
(
self
.
remote_id
):
super
()
.
delete
()
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment