Showing
3 changed files
with
51 additions
and
0 deletions
1 | +# Generated by Django 4.1.9 on 2023-09-12 21:23 | ||
2 | + | ||
3 | +from django.conf import settings | ||
4 | +from django.db import migrations, models | ||
5 | +import django.db.models.deletion | ||
6 | + | ||
7 | + | ||
8 | +class Migration(migrations.Migration): | ||
9 | + | ||
10 | + dependencies = [ | ||
11 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
12 | + ('edicto', '0013_alter_edicto_estado'), | ||
13 | + ] | ||
14 | + | ||
15 | + operations = [ | ||
16 | + migrations.AddField( | ||
17 | + model_name='edicto', | ||
18 | + name='usuario_movimiento', | ||
19 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='udate_edicto', to=settings.AUTH_USER_MODEL), | ||
20 | + ), | ||
21 | + ] |
1 | +# Generated by Django 4.1.9 on 2023-09-12 21:24 | ||
2 | +from django.conf import settings | ||
3 | +from django.db import migrations, models | ||
4 | +import django.db.models.deletion | ||
5 | + | ||
6 | + | ||
7 | +def migrar_edicto_usuario_movi(apps, schema): | ||
8 | + Edictos = apps.get_model('edicto', 'Edicto') | ||
9 | + user_move = 1 | ||
10 | + for edicto in Edictos.objects.all(): | ||
11 | + edicto.usuario_movimiento = user_move | ||
12 | + edicto.save() | ||
13 | + user_move = user_move+1 | ||
14 | + | ||
15 | + | ||
16 | +class Migration(migrations.Migration): | ||
17 | + | ||
18 | + dependencies = [ | ||
19 | + ('edicto', '0014_edicto_usuario_movimiento'), | ||
20 | + ] | ||
21 | + | ||
22 | + operations = [ | ||
23 | + migrations.RunPython(migrar_edicto_usuario_movi, reverse_code=migrations.RunPython.noop), | ||
24 | + migrations.AlterField( | ||
25 | + model_name='edicto', | ||
26 | + name='usuario_movimiento', | ||
27 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='udate_edicto', to=settings.AUTH_USER_MODEL) | ||
28 | + ), | ||
29 | + ] |
@@ -38,6 +38,7 @@ class Edicto(models.Model): | @@ -38,6 +38,7 @@ class Edicto(models.Model): | ||
38 | observaciones = models.CharField(max_length=500, blank=True, null=True) | 38 | observaciones = models.CharField(max_length=500, blank=True, null=True) |
39 | fecha_creacion = models.DateField(auto_now_add=True) | 39 | fecha_creacion = models.DateField(auto_now_add=True) |
40 | fecha_modificacion = models.DateTimeField(auto_now_add=True) | 40 | fecha_modificacion = models.DateTimeField(auto_now_add=True) |
41 | + usuario_movimiento = models.ForeignKey(Usuario, on_delete=models.CASCADE, related_name='udate_edicto') | ||
41 | 42 | ||
42 | class Meta: | 43 | class Meta: |
43 | verbose_name = 'Edicto' | 44 | verbose_name = 'Edicto' |
-
Please register or login to post a comment