models.TimeField shown without seconds in admin

Hi,
I am using the models.TimeField to get the time of running results. In the form to add the time I have got hh:mm:ss and this format is stored in the database.
grafik

But in the list in the admin area the time is only show with hh:mm. Is it possible to configure to show also the seconds?

grafik

Thank you
Andreas

See the TIME_FORMAT setting for global settings (Also see how that relates to the USE_L10N setting). If that’s not sufficient, then you’ll probably need to either write a custom changelist_view method or template.

Thank you for the answer.
That does not look easy. I hope to solve it.

There’s another option I just been made aware of, you could create a custom localization file. That looks like it might be easier.

I solved the format to show with html files.
{{ instance.result_value|time:“H:i:s” }}

The admin part is still in work.

I have solved the display in the admin area.

class ResultAdmin(admin.ModelAdmin):
list_display = ('time_seconds', ....)  
def time_seconds(self, obj):
        return obj.result_value.strftime("%H:%M:%S")

Thank you for the help.

1 Like