Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BDE
Note Kfet 2018
Commits
4ec3d61f
Commit
4ec3d61f
authored
Sep 03, 2018
by
Hamza Dely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[consos/views] On renvoie les identifiants des nouveaux objets lors d'un appel à l'API
parent
788da056
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
consos/views.py
consos/views.py
+6
-6
No files found.
consos/views.py
View file @
4ec3d61f
...
...
@@ -396,8 +396,8 @@ class NoteViewSet(viewsets.GenericViewSet):
"""
serializer
=
self
.
get_serializer
(
data
=
request
.
data
,
fields
=
[
'adherent'
])
serializer
.
is_valid
(
raise_exception
=
True
)
serializer
.
save
()
return
Response
({},
status
=
status
.
HTTP_201_CREATED
)
instance
=
serializer
.
save
()
return
Response
({
"id"
:
instance
.
id
},
status
=
status
.
HTTP_201_CREATED
)
@
detail_route
(
methods
=
[
'patch'
])
@
requires
(
"consos.note_soft_lock"
)
...
...
@@ -537,8 +537,8 @@ class BoutonViewSet(viewsets.GenericViewSet):
return
Response
({
"detail"
:
"Vous n'avez pas le droit de lier un bouton à une autre note que la vôtre"
},
status
=
status
.
HTTP_403_FORBIDDEN
)
if
note
.
type
not
in
[
note
.
proprietaire
.
CLUB
,
note
.
proprietaire
.
SECTION
]
and
not
request
.
user
.
has_perm
(
"consos.bouton_ajouter"
,
Acl
.
TOTAL
):
return
Response
({
"detail"
:
"Vous n'avez pas le droit de lier un bouton à autre chose qu'un club ou une section"
},
status
=
status
.
HTTP_403_FORBIDDEN
)
serializer
.
save
()
return
Response
({},
status
=
status
.
HTTP_201_CREATED
)
instance
=
serializer
.
save
()
return
Response
({
"id"
:
instance
.
id
},
status
=
status
.
HTTP_201_CREATED
)
@
requires
(
"consos.bouton_modifer"
)
def
partial_update
(
self
,
request
,
pk
=
None
):
...
...
@@ -618,8 +618,8 @@ class TransactionViewSet(viewsets.GenericViewSet):
if
(
any
(
emetteur
!=
request
.
user
for
emetteur
in
serializer
.
validated_data
.
get
(
'emetteurs'
,
[]))
and
not
request
.
user
.
has_perm
(
"consos.transaction_effectuer"
,
Acl
.
TOTAL
)):
return
Response
({
"detail"
:
"Vous ne pouvez faire que des transactions depuis vôtre note"
},
status
=
status
.
HTTP_403_FORBIDDEN
)
serializer
.
save
()
return
Response
({},
status
=
status
.
HTTP_201_CREATED
)
instances
=
serializer
.
save
()
return
Response
({
"id"
:
[
instance
.
id
for
instance
in
instances
]
},
status
=
status
.
HTTP_201_CREATED
)
@
detail_route
(
methods
=
[
'patch'
])
@
requires
(
"consos.transaction_devalider"
)
...
...
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