Skip to content

Instantly share code, notes, and snippets.

@lightstrike
Created February 7, 2017 14:43
Show Gist options
  • Save lightstrike/cffeb57fbe1412fc7e3ef66ab844db0d to your computer and use it in GitHub Desktop.
Save lightstrike/cffeb57fbe1412fc7e3ef66ab844db0d to your computer and use it in GitHub Desktop.
Abstract Base Django Model w/ DB Indexing
from django.db import models
from django.utils.translation import ugettext_lazy as _
from model_utils.fields import AutoCreatedField, AutoLastModifiedField
class IndexedTimeStampedModel(models.Model):
created = AutoCreatedField(_('created'), db_index=True)
modified = AutoLastModifiedField(_('modified'), db_index=True)
class Meta:
abstract = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment