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-11 09:27:31 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
24e1835d51e0e45e61fe564ec7f69dbd376fce34
24e1835d
1 parent
38ee3554
se actualizo con los cambios subidos en la feature/#45
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
7 deletions
project/apps/edicto/api.py
project/apps/edicto/filters.py
project/apps/edicto/migrations/0016_merge_20230911_0707.py
project/apps/edicto/models.py
project/apps/edicto/serializer.py
project/apps/edicto/api.py
View file @
24e1835
from
rest_framework
import
viewsets
,
filters
,
mixins
,
status
from
django.shortcuts
import
get_object_or_404
from
django_filters.rest_framework
import
DjangoFilterBackend
from
rest_framework.response
import
Response
from
rest_framework.permissions
import
IsAuthenticated
...
...
@@ -16,7 +17,6 @@ from .precio import calculadora
class
EdictoViewSet
(
mixins
.
CreateModelMixin
,
mixins
.
RetrieveModelMixin
,
mixins
.
UpdateModelMixin
,
mixins
.
DestroyModelMixin
,
mixins
.
ListModelMixin
,
viewsets
.
GenericViewSet
):
...
...
@@ -26,7 +26,8 @@ class EdictoViewSet(mixins.CreateModelMixin,
filterset_class
=
EdictoFilter
queryset
=
Edicto
.
objects
.
all
()
ordering_fields
=
(
'usuario'
,)
ordering
=
'usuario'
ordering
=
'fecha_creacion'
lookup_field
=
'uuid'
def
perform_create
(
self
,
serializer
):
edicto
=
self
.
request
.
data
.
get
(
'cuerpo_edicto'
)
...
...
project/apps/edicto/filters.py
View file @
24e1835
...
...
@@ -11,7 +11,7 @@ class EdictoFilter(filters.FilterSet):
model
=
Edicto
fields
=
{
'usuario'
:
[
'exact'
],
'estado'
:
[
'exact'
],
'id'
:
[
'exact'
],
'
uu
id'
:
[
'exact'
],
}
...
...
project/apps/edicto/migrations/0016_merge_20230911_0707.py
0 → 100644
View file @
24e1835
# Generated by Django 4.1.9 on 2023-09-11 10:07
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'edicto'
,
'0012_migracion_dato_uuid'
),
(
'edicto'
,
'0015_rename_archivo_comprobantepago_archivo_comprobante'
),
]
operations
=
[
]
...
...
project/apps/edicto/models.py
View file @
24e1835
...
...
@@ -44,7 +44,7 @@ class Edicto(models.Model):
verbose_name_plural
=
'Edictos'
def
__str__
(
self
):
return
f
"{self.u
suario
} - Edicto"
return
f
"{self.u
uid
} - Edicto"
class
ComprobantePago
(
models
.
Model
):
...
...
@@ -59,4 +59,5 @@ class ComprobantePago(models.Model):
verbose_name_plural
=
'ComprobantesPagos'
def
__str__
(
self
):
return
f
"{self.numero_comprobante} comprobante pago de {self.edicto.usuario}"
return
f
"{self.numero_comprobante} comprobante pago de {self.edicto.uuid}"
...
...
project/apps/edicto/serializer.py
View file @
24e1835
...
...
@@ -14,7 +14,8 @@ class EdictoSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Edicto
fields
=
(
'usuario'
,
fields
=
(
'uuid'
,
'usuario'
,
'estado'
,
'cuerpo_edicto'
,
'cantidad_palabras'
,
...
...
@@ -28,7 +29,7 @@ class EdictoSerializer(serializers.ModelSerializer):
)
read_only_fields
=
(
'usuario'
,
'fecha_publicacion'
,
'cantidad_palabras'
,
'fecha_creacion'
)
read_only_fields
=
(
'u
uid'
,
'u
suario'
,
'fecha_publicacion'
,
'cantidad_palabras'
,
'fecha_creacion'
)
def
to_representation
(
self
,
instance
):
data
=
super
()
.
to_representation
(
instance
)
...
...
Please
register
or
login
to post a comment