Showing
2 changed files
with
29 additions
and
1 deletions
@@ -17,7 +17,7 @@ class Migration(migrations.Migration): | @@ -17,7 +17,7 @@ class Migration(migrations.Migration): | ||
17 | migrations.AddField( | 17 | migrations.AddField( |
18 | model_name='usuario', | 18 | model_name='usuario', |
19 | name='cuil', | 19 | name='cuil', |
20 | - field=models.CharField(default=27242621528, max_length=11, unique=True, verbose_name='Número de Cuil (Sin guiones)'), | 20 | + field=models.CharField(max_length=11, blank=True, verbose_name='Número de Cuil (Sin guiones)'), |
21 | preserve_default=False, | 21 | preserve_default=False, |
22 | ), | 22 | ), |
23 | ] | 23 | ] |
1 | +# Generated by Django 4.1.9 on 2023-08-14 11:41 | ||
2 | + | ||
3 | +from django.db import migrations, models | ||
4 | + | ||
5 | + | ||
6 | +def asignar_valor_cuil(apps, schema): | ||
7 | + Usuario = apps.get_model('usuario', 'Usuario') | ||
8 | + nro_cuil = 1 | ||
9 | + for usuario in Usuario.objects.all(): | ||
10 | + usuario.cuil = nro_cuil | ||
11 | + usuario.save() | ||
12 | + nro_cuil = nro_cuil+1 | ||
13 | + | ||
14 | + | ||
15 | +class Migration(migrations.Migration): | ||
16 | + | ||
17 | + dependencies = [ | ||
18 | + ('usuario', '0002_remove_usuario_documento_identidad_usuario_cuil'), | ||
19 | + ] | ||
20 | + | ||
21 | + operations = [ | ||
22 | + migrations.RunPython(asignar_valor_cuil, reverse_code=migrations.RunPython.noop), | ||
23 | + migrations.AlterField( | ||
24 | + model_name='usuario', | ||
25 | + name='cuil', | ||
26 | + field=models.CharField(max_length=11, unique=True, verbose_name='Número de Cuil (Sin guiones)'), | ||
27 | + ), | ||
28 | + ] |
-
Please register or login to post a comment