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 09:59:28 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
507474687194a1964ce016743a4b37aa2d312071
50747468
1 parent
d638bcc6
correcion de archivos, filter, utils, y eliminacion de llamados que no estan en uso
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
10 deletions
project/apps/edicto/api.py
project/apps/edicto/filters.py
project/apps/edicto/utils.py
project/apps/edicto/api.py
View file @
5074746
from
rest_framework
import
viewsets
,
filters
,
mixins
,
status
,
serializers
from
rest_framework
import
viewsets
,
filters
,
mixins
,
status
from
django_filters.rest_framework
import
DjangoFilterBackend
from
rest_framework.response
import
Response
from
rest_framework.permissions
import
IsAuthenticated
...
...
@@ -11,7 +11,7 @@ from .filters import EdictoFilter, PrecioFilter
from
.pagination
import
CustomPagination
from
.permissions
import
IsAdminOrAuthorized
from
.utils
import
contador
# from .precio import calculadora
class
EdictoViewSet
(
mixins
.
CreateModelMixin
,
...
...
project/apps/edicto/filters.py
View file @
5074746
...
...
@@ -9,12 +9,10 @@ class EdictoFilter(filters.FilterSet):
class
Meta
:
model
=
Edicto
fields
=
(
'usuario'
,
'estado'
,
'fecha_creacion__gte'
,
'fecha_creacion__lte'
,
'id'
,
)
fields
=
{
'usuario'
:
[
'exact'
],
'estado'
:
[
'exact'
],
'id'
:
[
'exact'
],
}
class
PrecioFilter
(
filters
.
FilterSet
):
...
...
project/apps/edicto/utils.py
View file @
5074746
...
...
@@ -2,8 +2,8 @@ import re
def
contador
(
edicto
):
expresiones
=
re
.
findall
(
r'
\
(
\
.
\
.
\
.'
,
edicto
)
edicto_sin_guiones
=
re
.
sub
(
r'(?<!
\
w)-|-(?!
\
w)'
,
' '
,
edicto
)
palabras
=
re
.
split
(
r'
\
s+'
,
edicto_sin_guiones
)
palabras_filtradas
=
[
palabra
for
palabra
in
palabras
if
palabra
.
strip
()]
total_palabras
=
len
(
palabras_filtradas
)
total_palabras
=
len
(
palabras
)
+
len
(
expresiones
)
return
total_palabras
...
...
Please
register
or
login
to post a comment