1. Jaap Roes
  2. django-admin-timestamps


django-admin-timestamps /

Filename Size Date modified Message
193 B
syntax: glob
231 B
Tagging 1.2
658 B
Back to development: 1.3
1.0 KB
Dropped compat package (dropping Django < 1.4 support)
108 B
Initial boilerplate for testing
1.7 KB
Updated base, new boostrap, test running etc.
1.9 KB
minor documentation update
6.0 KB
Updated base, new boostrap, test running etc.
1.3 KB
Updated base, new boostrap, test running etc.
1.3 KB
Back to development: 1.3
695 B
Updated base, new boostrap, test running etc.

Django Admin Timestamps

Show human readable created/modified dates and/or times in the django.contrib.admin changelist for models that track the moment of creation and updates.


First you will need to have a model that tracks the moment of creation and modification. The barebones example for that is:

from django.db import models

class TimestampedItem(models.Model):
    created = models.DateTimeField('created', auto_now_add=True)
    modified = models.DateTimeField('modified', auto_now=True)

Or, if you are using django-extensions:

from django_extensions.db.models import TimeStampedModel

class TimestampedItem(TimeStampedModel):

Now it's time to register this model with Django's admin site.

Create a admin class, just like you'd usually do, but make it extend TimestampedAdminMixin as well as any other base admin class you use:

from django.contrib import admin
from models import TimestampedItem
from admintimestamps import TimestampedAdminMixin

class TimestampedAdmin(TimestampedAdminMixin, admin.ModelAdmin):

admin.site.register(TimestampedItem, TimestampedAdmin)

That's it!



If the names of you timestamp fields aren't created and modified but for example created_at and modified_at you'll need to do a tiny bit of configuration in the model admin class:

class TimestampedAdmin(TimestampedAdminMixin, admin.ModelAdmin):
    timestamp_fields = ('created_at', 'modified_at')

You can also use the timestamp_fields tuple to only show one field by only specifying the field you want to show:

class TimestampedAdmin(TimestampedAdminMixin, admin.ModelAdmin):
    timestamp_fields = ('modified',)