diff --git a/service_catalog/migrations/0028_set_last_update_on_request.py b/service_catalog/migrations/0028_set_last_update_on_request.py new file mode 100644 index 000000000..79fd7912d --- /dev/null +++ b/service_catalog/migrations/0028_set_last_update_on_request.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.13 on 2023-09-27 08:53 + +from django.db import migrations + + +def update_requests(apps, schema_editor): + Request = apps.get_model('service_catalog', 'Request') + for request in Request.objects.all(): + Request.objects.filter(pk=request.pk).update(created=request.date_submitted, + last_updated=request.date_submitted) + from service_catalog.models import RequestState + if request.state == RequestState.COMPLETE: + Request.objects.filter(pk=request.pk).update(last_updated=request.date_complete) + + +class Migration(migrations.Migration): + + dependencies = [ + ('service_catalog', '0027_alter_approvalworkflow_scopes'), + ] + + operations = [ + migrations.RunPython(update_requests), + ] diff --git a/templates/service_catalog/request_details/approval.html b/templates/service_catalog/request_details/approval.html index 50a39e289..6634d997e 100644 --- a/templates/service_catalog/request_details/approval.html +++ b/templates/service_catalog/request_details/approval.html @@ -231,8 +231,6 @@