coddingtonbear / django-measurement

Easily store, retrieve, and convert measurements of weight, volume, distance, area and more.
MIT License
145 stars 32 forks source link

Django admin doesn't show Zero time values #101

Open rajnishdahiya opened 4 years ago

rajnishdahiya commented 4 years ago

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.

codingjoe commented 4 years ago

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