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-29 07:04:50 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
828c431c46f7643d0b06ea1612b26e9629769669
828c431c
1 parent
db078b80
feature/#68_agregar_campos_edicto
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
project/apps/edicto/migrations/0002_rename_monto_comprobantepago_monto_descuento_and_more.py
project/apps/edicto/serializer.py
project/apps/usuario/views.py
project/apps/edicto/migrations/0002_rename_monto_comprobantepago_monto_descuento_and_more.py
View file @
828c431
# Generated by Django 4.1.9 on 2023-09-2
8 13:17
# Generated by Django 4.1.9 on 2023-09-2
9 10:02
from
django.db
import
migrations
,
models
...
...
@@ -30,7 +30,7 @@ class Migration(migrations.Migration):
migrations
.
AddField
(
model_name
=
'edicto'
,
name
=
'tiene_descuento'
,
field
=
models
.
BooleanField
(
default
=
False
,
editable
=
False
),
field
=
models
.
BooleanField
(
editable
=
False
),
preserve_default
=
False
,
),
migrations
.
AddField
(
...
...
project/apps/edicto/serializer.py
View file @
828c431
...
...
@@ -4,6 +4,7 @@ from usuario.serializers import UsuarioListaSerializer
from
.constants
import
EXTENSIONES_VALIDAS
from
.models
import
Edicto
,
Precio
from
.utils
import
contador
from
.precio
import
contador
class
EdictoSerializer
(
serializers
.
ModelSerializer
):
...
...
@@ -41,6 +42,7 @@ class EdictoSerializer(serializers.ModelSerializer):
data
[
'creado_por'
]
=
request
.
user
data
[
'modificado_por'
]
=
request
.
user
return
data
@staticmethod
...
...
project/apps/usuario/views.py
View file @
828c431
...
...
@@ -9,20 +9,20 @@ class CustomTokenView(TokenView):
# realizar validaciones de recaptcha
if
'captcha_value'
not
in
request
.
POST
:
raise
AttributeError
(
"El campo Valor de Captcha es obligatorio"
"El campo Valor de Captcha es obligatorio"
)
r
=
requests
.
post
(
'https://www.google.com/recaptcha/api/siteverify'
,
data
=
{
'secret'
:
settings
.
SECRET_KEY_CAPTCHA
,
'response'
:
request
.
POST
[
'captcha_value'
],
'secret'
:
settings
.
SECRET_KEY_CAPTCHA
,
'response'
:
request
.
POST
[
'captcha_value'
],
}
)
respuesta
=
r
.
json
()
if
not
respuesta
[
"success"
]:
raise
AttributeError
(
"Captcha inválido: "
+
respuesta
[
'error-codes'
][
0
]
"Captcha inválido: "
+
respuesta
[
'error-codes'
][
0
]
)
return
super
()
.
post
(
request
,
*
args
,
**
kwargs
)
...
...
Please
register
or
login
to post a comment