django-measurement icon indicating copy to clipboard operation
django-measurement copied to clipboard

Django admin doesn't show Zero time values

Open rajnishdahiya opened this issue 4 years ago • 1 comments

If a time value is zero then it shows as empty in Django Admin. This is an issue while updating the object, I have to enter zero value for Time field every time even though I was updating other fields of model.

instructor_time_required = MeasurementField(measurement=Time, unit_choices=[ ['min', 'min'], ['hr', 'hr'] ], help_text="Total time per instructor that will be spent on delivering this unit", validators=[MinValueValidator(Time(min=0))], )

As field is non null, I have to enter Zero every time image

Actual value of the field is Zero as I can see in pgAdmin image

Probably issue is there for other measures as well, didn't check.

rajnishdahiya avatar Aug 19 '20 05:08 rajnishdahiya

Hi @codingjoe thanks for reaching out. Yes, this seems to be a bug. Yet, I don't have the capacity to fix it right now, considering I am working on a new major release supporting the rewrite of the underlying Python package. Feel free to provide a patch until then, I would be happy to review it. Otherwise, it will only have time to look into this after the release. Best, Joe

codingjoe avatar Aug 20 '20 13:08 codingjoe