Skip to content

Commit

Permalink
Add migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Alireza Asadi committed Nov 2, 2024
1 parent e8e906d commit 5e16448
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions api/migrations/0034_note_summary_submit_status.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 5.0.1 on 2024-10-26 10:03

from django.db import migrations, models
from api.models import SubmitStatus

def set_initial_submit_status_for_existing_notes_summaries(apps, schema_editor):
Note = apps.get_model('api', 'Note')
Summary = apps.get_model('api', 'Summary')

Note.objects.filter(submit_status=SubmitStatus.DRAFT).update(submit_status=SubmitStatus.INITIAL_SUBMIT)
Summary.objects.filter(submit_status=SubmitStatus.DRAFT).update(submit_status=SubmitStatus.INITIAL_SUBMIT)


class Migration(migrations.Migration):

dependencies = [
('api', '0033_noteuseraccess_can_view_summary_initialize'),
]

operations = [
migrations.AddField(
model_name='note',
name='submit_status',
field=models.IntegerField(choices=[(0, 'درفت'), (1, 'ثبت اولیه'), (2, 'ثبت نهایی')], default=0, verbose_name='وضعیت'),
),
migrations.AddField(
model_name='summary',
name='submit_status',
field=models.IntegerField(choices=[(0, 'درفت'), (1, 'ثبت اولیه'), (2, 'ثبت نهایی')], default=0, verbose_name='وضعیت'),
),
migrations.RunPython(set_initial_submit_status_for_existing_notes_summaries),
]

0 comments on commit 5e16448

Please sign in to comment.