Merge branch 'feature/#26_agregar_cuil_al_usuario' into 'develop'
Se modifico cuil por dni See merge request !20
Showing
5 changed files
with
34 additions
and
11 deletions
@@ -14,10 +14,10 @@ CONTENT_TYPE_JSON = 'application/json' | @@ -14,10 +14,10 @@ CONTENT_TYPE_JSON = 'application/json' | ||
14 | 14 | ||
15 | 15 | ||
16 | def create_user(username, first_name='Admin', last_name='Root', email=None, *, is_active=True, | 16 | def create_user(username, first_name='Admin', last_name='Root', email=None, *, is_active=True, |
17 | - documento_identidad='24262155'): | 17 | + cuil='27242621558'): |
18 | user, created = User.objects.get_or_create( | 18 | user, created = User.objects.get_or_create( |
19 | username=username, | 19 | username=username, |
20 | - documento_identidad=documento_identidad, | 20 | + cuil=cuil, |
21 | email='{}@root.com'.format(username) if email is None else email, | 21 | email='{}@root.com'.format(username) if email is None else email, |
22 | defaults=dict( | 22 | defaults=dict( |
23 | first_name=first_name, | 23 | first_name=first_name, |
@@ -71,20 +71,20 @@ def agregar_varios_permisos_grupo(permisos_por_app, grupo): | @@ -71,20 +71,20 @@ def agregar_varios_permisos_grupo(permisos_por_app, grupo): | ||
71 | 71 | ||
72 | @pytest.fixture | 72 | @pytest.fixture |
73 | def get_default_test_user(): | 73 | def get_default_test_user(): |
74 | - test_user = create_user(username='test_user', first_name='Test', last_name='User', email='tests@user', documento_identidad='12345678') | 74 | + test_user = create_user(username='test_user', first_name='Test', last_name='User', email='tests@user', cuil='27123456788') |
75 | return test_user | 75 | return test_user |
76 | 76 | ||
77 | 77 | ||
78 | @pytest.fixture | 78 | @pytest.fixture |
79 | def crear_usuarios(): | 79 | def crear_usuarios(): |
80 | usuario1 = create_user(username='usuario1', first_name='Usuario', last_name='J', | 80 | usuario1 = create_user(username='usuario1', first_name='Usuario', last_name='J', |
81 | - email='tests@user1', documento_identidad='12345777') | 81 | + email='tests@user1', cuil='27123457778') |
82 | 82 | ||
83 | usuario2 = create_user(username='usuario2', first_name='Usuario', last_name='S', | 83 | usuario2 = create_user(username='usuario2', first_name='Usuario', last_name='S', |
84 | - email='tests@user2', documento_identidad='12345679') | 84 | + email='tests@user2', cuil='27123456798') |
85 | 85 | ||
86 | usuario3 = create_user(username='usuario3', first_name='Usuario', last_name='P', | 86 | usuario3 = create_user(username='usuario3', first_name='Usuario', last_name='P', |
87 | - email='tests@user3', documento_identidad='12345699') | 87 | + email='tests@user3', cuil='27123456998') |
88 | 88 | ||
89 | return usuario1, usuario2, usuario3 | 89 | return usuario1, usuario2, usuario3 |
90 | 90 |
@@ -15,7 +15,7 @@ class UsuarioAdmin(UserAdmin): | @@ -15,7 +15,7 @@ class UsuarioAdmin(UserAdmin): | ||
15 | 'first_name', | 15 | 'first_name', |
16 | 'last_name', | 16 | 'last_name', |
17 | 'email', | 17 | 'email', |
18 | - 'documento_identidad' | 18 | + 'cuil' |
19 | ) | 19 | ) |
20 | }), | 20 | }), |
21 | (_('Organismo'), {'fields': ('organismo',)}), | 21 | (_('Organismo'), {'fields': ('organismo',)}), |
@@ -28,9 +28,9 @@ class UsuarioAdmin(UserAdmin): | @@ -28,9 +28,9 @@ class UsuarioAdmin(UserAdmin): | ||
28 | (None, { | 28 | (None, { |
29 | 'classes': ('wide',), | 29 | 'classes': ('wide',), |
30 | 'fields': ( | 30 | 'fields': ( |
31 | - 'first_name', 'last_name', 'username', "password1", "password2", 'email', 'documento_identidad', | 31 | + 'first_name', 'last_name', 'username', "password1", "password2", 'email', 'cuil', |
32 | 'organismo', 'is_staff',)} | 32 | 'organismo', 'is_staff',)} |
33 | ), | 33 | ), |
34 | ) | 34 | ) |
35 | - search_fields = ('email', 'documento_identidad', 'username',) | 35 | + search_fields = ('email', 'cuil', 'username',) |
36 | autocomplete_fields = ('organismo',) | 36 | autocomplete_fields = ('organismo',) |
1 | +# Generated by Django 4.1.9 on 2023-08-11 11:45 | ||
2 | + | ||
3 | +from django.db import migrations, models | ||
4 | + | ||
5 | + | ||
6 | +class Migration(migrations.Migration): | ||
7 | + | ||
8 | + dependencies = [ | ||
9 | + ('usuario', '0001_initial'), | ||
10 | + ] | ||
11 | + | ||
12 | + operations = [ | ||
13 | + migrations.RemoveField( | ||
14 | + model_name='usuario', | ||
15 | + name='documento_identidad', | ||
16 | + ), | ||
17 | + migrations.AddField( | ||
18 | + model_name='usuario', | ||
19 | + name='cuil', | ||
20 | + field=models.CharField(default=27242621528, max_length=11, unique=True, verbose_name='Número de Cuil (Sin guiones)'), | ||
21 | + preserve_default=False, | ||
22 | + ), | ||
23 | + ] |
@@ -6,7 +6,7 @@ class Usuario(AbstractUser): | @@ -6,7 +6,7 @@ class Usuario(AbstractUser): | ||
6 | class Meta: | 6 | class Meta: |
7 | db_table = 'auth_user' | 7 | db_table = 'auth_user' |
8 | 8 | ||
9 | - documento_identidad = models.CharField(max_length=15, verbose_name='Número de documento', unique=True) | 9 | + cuil = models.CharField(max_length=11, verbose_name='Número de Cuil (Sin guiones)', unique=True) |
10 | organismo = models.ForeignKey('organismo.Organismo', on_delete=models.SET_NULL, blank=True, null=True) | 10 | organismo = models.ForeignKey('organismo.Organismo', on_delete=models.SET_NULL, blank=True, null=True) |
11 | 11 | ||
12 | def __str__(self): | 12 | def __str__(self): |
@@ -14,7 +14,7 @@ class UsuarioSerializer(serializers.ModelSerializer): | @@ -14,7 +14,7 @@ class UsuarioSerializer(serializers.ModelSerializer): | ||
14 | 'first_name', | 14 | 'first_name', |
15 | 'last_name', | 15 | 'last_name', |
16 | 'email', | 16 | 'email', |
17 | - 'documento_identidad', | 17 | + 'cuil', |
18 | 'organismo', | 18 | 'organismo', |
19 | 'permisos_usuario', | 19 | 'permisos_usuario', |
20 | ) | 20 | ) |
-
Please register or login to post a comment