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-07-12 09:16:12 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4dbae5393c06671c4e72640ff57a9b8d0a9ea25f
4dbae539
1 parent
0053fe6f
eliminacion_de_comentarios_en_el_codigo
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
22 deletions
project/apps/edicto/api.py
project/apps/edicto/contador.py
project/apps/edicto/migrations/0002_alter_comprobantepago_fecha_pago_and_more.py
project/apps/edicto/models.py
project/apps/edicto/serializer.py
project/apps/edicto/utils.py
project/apps/edicto/api.py
View file @
4dbae53
...
...
@@ -21,20 +21,3 @@ class EdictoView(viewsets.ModelViewSet):
serializer
.
save
(
cantidad_palabras
=
cantidad_palabras
)
return
Response
(
serializer
.
data
,
status
=
status
.
HTTP_201_CREATED
)
''' class EdictoView(viewsets.ModelViewSet):
queryset = Edicto.objects.all()
serializer_class = EdictoSerializer
@action(detail=True, methods='post')
def post(self, request):
edicto = request.data.get('edicto')
cantidad_palabras = contador(edicto)
serializer = self.get_serializer(data=request.data)
if not serializer.is_valid(raise_exception=True):
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
serializer.save(cantidad_palabras=cantidad_palabras)
return Response(serializer.data, status=status.HTTP_201_CREATED)
'''
\ No newline at end of file
...
...
project/apps/edicto/contador.py
View file @
4dbae53
from
django.db.models
import
F
from
organismo.models
import
Organismo
from
.models
import
Edicto
,
ComprobantePago
...
...
project/apps/edicto/migrations/0002_alter_comprobantepago_fecha_pago_and_more.py
0 → 100644
View file @
4dbae53
# Generated by Django 4.1.9 on 2023-07-12 12:00
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'edicto'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'comprobantepago'
,
name
=
'fecha_pago'
,
field
=
models
.
DateTimeField
(
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'comprobantepago'
,
name
=
'numero_comprobante'
,
field
=
models
.
CharField
(
max_length
=
300
,
null
=
True
),
),
]
...
...
project/apps/edicto/models.py
View file @
4dbae53
...
...
@@ -49,8 +49,8 @@ class Edicto(models.Model):
class
ComprobantePago
(
models
.
Model
):
edicto
=
models
.
ForeignKey
(
Edicto
,
on_delete
=
models
.
CASCADE
)
resultado
=
models
.
FloatField
(
blank
=
False
,
null
=
False
)
numero_comprobante
=
models
.
CharField
(
max_length
=
300
,
blank
=
False
,
null
=
False
)
fecha_pago
=
models
.
DateTimeField
()
numero_comprobante
=
models
.
CharField
(
max_length
=
300
,
blank
=
False
,
null
=
True
)
fecha_pago
=
models
.
DateTimeField
(
blank
=
False
,
null
=
True
)
class
Meta
:
verbose_name
=
'ComprobantePago'
...
...
project/apps/edicto/serializer.py
View file @
4dbae53
...
...
@@ -10,4 +10,4 @@ class EdictoSerializer(serializers.ModelSerializer):
class
Meta
:
model
=
Edicto
exclude
=
(
'updated'
,)
\ No newline at end of file
exclude
=
(
'updated'
,)
...
...
project/apps/edicto/utils.py
View file @
4dbae53
...
...
@@ -17,5 +17,5 @@ def contador(edicto):
cantidad_palabras
=
len
(
texto
)
cantidad_numeros
=
len
(
numeros
)
cantidad_expresiones
=
len
(
expresiones
)
total_edicto
=
cantidad_palabras
+
cantidad_numeros
+
cantidad_expresiones
-
1
total_edicto
=
cantidad_palabras
+
cantidad_numeros
+
cantidad_expresiones
-
1
return
total_edicto
...
...
Please
register
or
login
to post a comment