Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created January 27, 2015 16:18
Show Gist options
  • Save groovecoder/c8b4c187d8883d7b0964 to your computer and use it in GitHub Desktop.
Save groovecoder/c8b4c187d8883d7b0964 to your computer and use it in GitHub Desktop.
class KeyAction(models.Model):
"""Record of an action taken while using a key"""
key = models.ForeignKey(Key, related_name='history', db_index=True)
action = models.CharField(max_length=128, blank=False)
notes = models.TextField(null=True)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')
created = models.DateTimeField(auto_now_add=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment