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-19 08:47:25 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ce5a86b2498a1c9b6dc9d015a80d13218661319b
ce5a86b2
1 parent
a89c6edc
validacion de usuario
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
project/apps/edicto/models.py
project/apps/edicto/serializer.py
project/apps/edicto/models.py
View file @
ce5a86b
...
...
@@ -26,7 +26,7 @@ class Precio (models.Model):
class
Edicto
(
models
.
Model
):
uuid
=
models
.
UUIDField
(
unique
=
True
,
editable
=
False
,
default
=
uuid4
,
primary_key
=
True
)
usuario
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
'Usuario'
)
usuario
=
models
.
ForeignKey
(
Usuario
,
on_delete
=
models
.
CASCADE
,
verbose_name
=
'Usuario'
,
unique
=
True
)
cuerpo_edicto
=
models
.
TextField
(
blank
=
False
,
null
=
False
)
archivo
=
models
.
FileField
(
upload_to
=
"uploads/
%
Y/
%
m/
%
d/"
,
null
=
False
,
blank
=
False
)
dias_publicar
=
models
.
PositiveIntegerField
(
blank
=
False
,
null
=
False
)
...
...
project/apps/edicto/serializer.py
View file @
ce5a86b
...
...
@@ -43,7 +43,10 @@ class EdictoSerializer(serializers.ModelSerializer):
cantidad_palabras
=
contador
(
edicto
)
data
[
'cantidad_palabras'
]
=
cantidad_palabras
request
=
self
.
context
[
'request'
]
data
[
'usuario'
]
=
request
.
user
if
request
.
method
==
'POST'
:
data
[
'usuario'
]
=
request
.
user
else
:
pass
data
[
'usuario_movimiento'
]
=
request
.
user
return
data
...
...
Please
register
or
login
to post a comment