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-04 06:58:55 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d638bcc6446e583ab52ca1bbff77d51ba19a2235
d638bcc6
1 parent
ad1f13a0
correcion de usuario__usuario en el filter de precio y eliminacion del metodo validate
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 additions
and
11 deletions
project/apps/edicto/api.py
project/apps/edicto/serializer.py
project/apps/edicto/api.py
View file @
d638bcc
...
...
@@ -54,7 +54,7 @@ class PrecioViewSet(viewsets.ReadOnlyModelViewSet):
permission_classes
=
[
IsAuthenticated
,
IsAdminOrAuthorized
]
filter_backends
=
(
DjangoFilterBackend
,
filters
.
OrderingFilter
)
filterset_class
=
PrecioFilter
ordering_fields
=
(
'usuario
__usuario
'
,
)
ordering_fields
=
(
'usuario'
,
)
ordering
=
'usuario'
queryset
=
Precio
.
objects
.
all
()
pagination_class
=
CustomPagination
...
...
project/apps/edicto/serializer.py
View file @
d638bcc
...
...
@@ -57,16 +57,6 @@ class PrecioSerializer(serializers.ModelSerializer):
'vigencia_hasta'
,
)
def
validate
(
self
,
data
):
request
=
self
.
context
.
get
(
'request'
)
user
=
request
.
user
if
request
else
None
if
not
user
or
user
.
is_anonymous
:
raise
serializers
.
ValidationError
(
"El usuario debe estar autenticado."
)
if
not
user
.
is_staff
:
raise
serializers
.
ValidationError
(
"El usuario no es parte del personal designado."
)
return
data
included_serializers
=
{
'usuario'
:
UsuarioListaSerializer
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment