Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Marta Miranda
/
boletin_api
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Enzo Yair
2023-09-15 08:23:33 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
26265943572de3dc55d50c34d696d054433747ed
26265943
1 parent
a2253e7d
se elimino decorador @action
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
project/apps/edicto/api.py
project/apps/edicto/serializer.py
project/apps/edicto/api.py
View file @
2626594
...
...
@@ -14,6 +14,7 @@ from .utils import contador
class
EdictoViewSet
(
mixins
.
CreateModelMixin
,
mixins
.
RetrieveModelMixin
,
mixins
.
UpdateModelMixin
,
mixins
.
ListModelMixin
,
viewsets
.
GenericViewSet
):
...
...
@@ -35,9 +36,9 @@ class EdictoViewSet(mixins.CreateModelMixin,
usuario_movimiento
=
usuario
,
)
def
partial_update
(
self
,
request
):
def
update
(
self
,
request
,
*
args
,
**
kwargs
):
instance
=
self
.
get_object
()
serializer
=
self
.
get_serializer
(
instance
,
data
=
request
.
data
,
partial
=
True
)
serializer
=
self
.
get_serializer
(
instance
,
data
=
request
.
data
)
serializer
.
is_valid
(
raise_exception
=
True
)
edicto
=
request
.
data
.
get
(
'cuerpo_edicto'
)
...
...
project/apps/edicto/serializer.py
View file @
2626594
...
...
@@ -40,7 +40,7 @@ class EdictoSerializer(serializers.ModelSerializer):
def
to_representation
(
self
,
instance
):
data
=
super
()
.
to_representation
(
instance
)
if
instance
.
fecha_modificacion
is
not
None
and
self
.
context
[
'request'
]
.
method
==
'P
ATCH
'
:
if
instance
.
fecha_modificacion
is
not
None
and
self
.
context
[
'request'
]
.
method
==
'P
UT
'
:
data
[
'fecha_modificacion'
]
=
instance
.
fecha_modificacion
else
:
data
[
'fecha_modificacion'
]
=
None
...
...
Please
register
or
login
to post a comment