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
3ef0798e
authored
Jul 24, 2019
by
Bodor Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix flake8 error
parent
65508250
Pipeline
#794
failed with stages
in 59 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
recircle/image/models.py
+3
-4
recircle/image/views.py
+1
-3
No files found.
recircle/image/models.py
View file @
3ef0798e
...
...
@@ -101,12 +101,12 @@ class Image(models.Model):
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
)
...
...
@@ -118,4 +118,4 @@ class Image(models.Model):
for
(
key
,
value
)
in
data
.
items
():
setattr
(
self
,
key
,
value
)
self
.
save
()
return
self
.
get
()
\ No newline at end of file
return
self
.
get
()
recircle/image/views.py
View file @
3ef0798e
# from django.shortcuts import render
from
rest_framework.viewsets
import
ViewSet
from
rest_framework.response
import
Response
from
django.http
import
HttpResponse
from
django.shortcuts
import
get_object_or_404
from
rest_framework
import
status
from
django.core.exceptions
import
ObjectDoesNotExist
...
...
@@ -34,7 +33,7 @@ class ImageViewSet(ViewSet):
)
serializer
=
ImageSerializer
(
instance
=
new_image
)
return
Response
(
serializer
.
data
)
def
retrieve
(
self
,
request
,
pk
=
None
):
queryset
=
Image
.
objects
.
all
()
image
=
get_object_or_404
(
queryset
,
pk
=
pk
)
...
...
@@ -43,7 +42,6 @@ class ImageViewSet(ViewSet):
serializer
=
ImageSerializer
(
instance
=
image
)
return
Response
(
serializer
.
data
)
def
update
(
self
,
request
,
pk
=
None
):
serializer
=
ImageUpdateSerializer
(
data
=
request
.
data
)
serializer
.
is_valid
(
raise_exception
=
True
)
...
...
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