How can I override the Django DurationField model to input minutes instead of seconds?

Viewed 26
1 Answers

I have it working now.

I did the following based on the older answer:

class CustomDurationModel(models.DurationField):

def prepare_value(self, value):
    if isinstance(value, datetime.timedelta):
        theinput = (value * 60)
        return theinput

then in the model: duration_input = CustomDurationModel(null=True)

I then made new migrations (python manage.py makemigrations).

Related