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-18 12:00:27 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f0909e95059cce17301393cae77023f072d24c5b
f0909e95
1 parent
ab1b7a64
delete metodo to_representation
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
10 deletions
project/apps/edicto/api.py
project/apps/edicto/models.py
project/apps/edicto/serializer.py
project/apps/edicto/api.py
View file @
f0909e9
...
...
@@ -13,6 +13,7 @@ from .utils import contador
class
EdictoViewSet
(
mixins
.
CreateModelMixin
,
mixins
.
RetrieveModelMixin
,
mixins
.
UpdateModelMixin
,
mixins
.
ListModelMixin
,
viewsets
.
GenericViewSet
):
...
...
project/apps/edicto/models.py
View file @
f0909e9
...
...
@@ -36,8 +36,8 @@ class Edicto(models.Model):
cantidad_copias
=
models
.
PositiveIntegerField
(
blank
=
False
,
null
=
False
)
fecha_publicacion
=
models
.
DateField
(
blank
=
True
,
null
=
True
)
observaciones
=
models
.
CharField
(
max_length
=
500
,
blank
=
True
,
null
=
True
)
fecha_creacion
=
models
.
DateField
(
auto_now_add
=
True
)
fecha_modificacion
=
models
.
DateTimeField
(
auto_now_add
=
True
)
fecha_creacion
=
models
.
DateField
(
auto_now
=
True
,
editable
=
False
)
fecha_modificacion
=
models
.
DateTimeField
(
auto_now_add
=
True
,
editable
=
False
)
usuario_movimiento
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
related_name
=
'udate_edicto'
)
class
Meta
:
...
...
project/apps/edicto/serializer.py
View file @
f0909e9
...
...
@@ -41,14 +41,6 @@ class EdictoSerializer(serializers.ModelSerializer):
'fecha_modificacion'
,
)
def
to_representation
(
self
,
instance
):
data
=
super
()
.
to_representation
(
instance
)
if
instance
.
fecha_modificacion
is
not
None
and
self
.
context
[
'request'
]
.
method
==
'PATCH'
:
data
[
'fecha_modificacion'
]
=
instance
.
fecha_modificacion
else
:
data
[
'fecha_modificacion'
]
=
None
return
data
@staticmethod
def
validate_archivo
(
value
):
filename
,
extension
=
value
.
name
.
rsplit
(
"."
,
1
)
...
...
Please
register
or
login
to post a comment