-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add DenominationValidator to validate dosage fields in Prescription m…
…odel (#1716) * Add DosageValidator to Prescription model * make the validator more generic * fix migrations * update migrations
- Loading branch information
Showing
6 changed files
with
396 additions
and
112 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
care/facility/migrations/0398_alter_prescription_dosage_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Generated by Django 4.2.5 on 2023-12-06 13:06 | ||
|
||
from django.db import migrations, models | ||
|
||
import care.utils.models.validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("facility", "0397_truncate_discharge_time"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="prescription", | ||
name="dosage", | ||
field=models.CharField( | ||
blank=True, | ||
max_length=100, | ||
null=True, | ||
validators=[ | ||
care.utils.models.validators.DenominationValidator( | ||
allow_floats=True, | ||
max_amount=5000, | ||
min_amount=0.0001, | ||
precision=4, | ||
units={"mg", "g", "ml", "tsp", "ampule(s)", "drop(s)"}, | ||
) | ||
], | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="prescription", | ||
name="max_dosage", | ||
field=models.CharField( | ||
blank=True, | ||
max_length=100, | ||
null=True, | ||
validators=[ | ||
care.utils.models.validators.DenominationValidator( | ||
allow_floats=True, | ||
max_amount=5000, | ||
min_amount=0.0001, | ||
precision=4, | ||
units={"mg", "g", "ml", "tsp", "ampule(s)", "drop(s)"}, | ||
) | ||
], | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 0 additions & 110 deletions
110
care/facility/tests/test_medicine_administrations_api.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.