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
Marta Miranda
2023-08-11 12:02:05 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
218586b4d3675e1e83fa8a8b5d7b4c724a2b17eb
218586b4
1 parent
3b32acef
Se modifico cuil por dni
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
11 deletions
project/apps/core/tests/fixtures.py
project/apps/usuario/admin.py
project/apps/usuario/migrations/0002_remove_usuario_documento_identidad_usuario_cuil.py
project/apps/usuario/models.py
project/apps/usuario/serializers.py
project/apps/core/tests/fixtures.py
View file @
218586b
...
...
@@ -14,10 +14,10 @@ CONTENT_TYPE_JSON = 'application/json'
def
create_user
(
username
,
first_name
=
'Admin'
,
last_name
=
'Root'
,
email
=
None
,
*
,
is_active
=
True
,
documento_identidad
=
'24262155
'
):
cuil
=
'27242621558
'
):
user
,
created
=
User
.
objects
.
get_or_create
(
username
=
username
,
documento_identidad
=
documento_identidad
,
cuil
=
cuil
,
email
=
'{}@root.com'
.
format
(
username
)
if
email
is
None
else
email
,
defaults
=
dict
(
first_name
=
first_name
,
...
...
@@ -71,20 +71,20 @@ def agregar_varios_permisos_grupo(permisos_por_app, grupo):
@pytest.fixture
def
get_default_test_user
():
test_user
=
create_user
(
username
=
'test_user'
,
first_name
=
'Test'
,
last_name
=
'User'
,
email
=
'tests@user'
,
documento_identidad
=
'1234567
8'
)
test_user
=
create_user
(
username
=
'test_user'
,
first_name
=
'Test'
,
last_name
=
'User'
,
email
=
'tests@user'
,
cuil
=
'2712345678
8'
)
return
test_user
@pytest.fixture
def
crear_usuarios
():
usuario1
=
create_user
(
username
=
'usuario1'
,
first_name
=
'Usuario'
,
last_name
=
'J'
,
email
=
'tests@user1'
,
documento_identidad
=
'12345777
'
)
email
=
'tests@user1'
,
cuil
=
'27123457778
'
)
usuario2
=
create_user
(
username
=
'usuario2'
,
first_name
=
'Usuario'
,
last_name
=
'S'
,
email
=
'tests@user2'
,
documento_identidad
=
'12345679
'
)
email
=
'tests@user2'
,
cuil
=
'27123456798
'
)
usuario3
=
create_user
(
username
=
'usuario3'
,
first_name
=
'Usuario'
,
last_name
=
'P'
,
email
=
'tests@user3'
,
documento_identidad
=
'12345699
'
)
email
=
'tests@user3'
,
cuil
=
'27123456998
'
)
return
usuario1
,
usuario2
,
usuario3
...
...
project/apps/usuario/admin.py
View file @
218586b
...
...
@@ -15,7 +15,7 @@ class UsuarioAdmin(UserAdmin):
'first_name'
,
'last_name'
,
'email'
,
'
documento_identidad
'
'
cuil
'
)
}),
(
_
(
'Organismo'
),
{
'fields'
:
(
'organismo'
,)}),
...
...
@@ -28,9 +28,9 @@ class UsuarioAdmin(UserAdmin):
(
None
,
{
'classes'
:
(
'wide'
,),
'fields'
:
(
'first_name'
,
'last_name'
,
'username'
,
"password1"
,
"password2"
,
'email'
,
'
documento_identidad
'
,
'first_name'
,
'last_name'
,
'username'
,
"password1"
,
"password2"
,
'email'
,
'
cuil
'
,
'organismo'
,
'is_staff'
,)}
),
)
search_fields
=
(
'email'
,
'
documento_identidad
'
,
'username'
,)
search_fields
=
(
'email'
,
'
cuil
'
,
'username'
,)
autocomplete_fields
=
(
'organismo'
,)
...
...
project/apps/usuario/migrations/0002_remove_usuario_documento_identidad_usuario_cuil.py
0 → 100644
View file @
218586b
# Generated by Django 4.1.9 on 2023-08-11 11:45
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'usuario'
,
'0001_initial'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'usuario'
,
name
=
'documento_identidad'
,
),
migrations
.
AddField
(
model_name
=
'usuario'
,
name
=
'cuil'
,
field
=
models
.
CharField
(
default
=
27242621528
,
max_length
=
11
,
unique
=
True
,
verbose_name
=
'Número de Cuil (Sin guiones)'
),
preserve_default
=
False
,
),
]
...
...
project/apps/usuario/models.py
View file @
218586b
...
...
@@ -6,7 +6,7 @@ class Usuario(AbstractUser):
class
Meta
:
db_table
=
'auth_user'
documento_identidad
=
models
.
CharField
(
max_length
=
15
,
verbose_name
=
'Número de documento
'
,
unique
=
True
)
cuil
=
models
.
CharField
(
max_length
=
11
,
verbose_name
=
'Número de Cuil (Sin guiones)
'
,
unique
=
True
)
organismo
=
models
.
ForeignKey
(
'organismo.Organismo'
,
on_delete
=
models
.
SET_NULL
,
blank
=
True
,
null
=
True
)
def
__str__
(
self
):
...
...
project/apps/usuario/serializers.py
View file @
218586b
...
...
@@ -14,7 +14,7 @@ class UsuarioSerializer(serializers.ModelSerializer):
'first_name'
,
'last_name'
,
'email'
,
'
documento_identidad
'
,
'
cuil
'
,
'organismo'
,
'permisos_usuario'
,
)
...
...
Please
register
or
login
to post a comment