From b842e691f97bda20a34701c5d20075af34edc860 Mon Sep 17 00:00:00 2001 From: Aakash Singh Date: Wed, 22 Jan 2025 17:57:04 +0530 Subject: [PATCH] add now as default for authored datetime --- care/emr/migrations/0009_medicationrequest_authored_on.py | 3 ++- care/emr/models/medication_request.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/care/emr/migrations/0009_medicationrequest_authored_on.py b/care/emr/migrations/0009_medicationrequest_authored_on.py index 88e8ab4d51..65aa78b4fd 100644 --- a/care/emr/migrations/0009_medicationrequest_authored_on.py +++ b/care/emr/migrations/0009_medicationrequest_authored_on.py @@ -1,5 +1,6 @@ # Generated by Django 5.1.4 on 2025-01-21 11:15 +import django.utils.timezone from django.db import migrations, models @@ -13,6 +14,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='medicationrequest', name='authored_on', - field=models.DateTimeField(blank=True, default=None, null=True), + field=models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True), ), ] diff --git a/care/emr/models/medication_request.py b/care/emr/models/medication_request.py index 9de05d8b02..04ed5fef77 100644 --- a/care/emr/models/medication_request.py +++ b/care/emr/models/medication_request.py @@ -1,4 +1,5 @@ from django.db import models +from django.utils import timezone from care.emr.models.base import EMRBaseModel @@ -16,4 +17,4 @@ class MedicationRequest(EMRBaseModel): encounter = models.ForeignKey("emr.Encounter", on_delete=models.CASCADE) dosage_instruction = models.JSONField(default=list, null=True, blank=True) note = models.TextField(null=True, blank=True) - authored_on = models.DateTimeField(null=True, blank=True, default=None) + authored_on = models.DateTimeField(null=True, blank=True, default=timezone.now)