Skip to content

Instantly share code, notes, and snippets.

@luzfcb
Created June 30, 2015 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luzfcb/226612d0b98dd4493f9d to your computer and use it in GitHub Desktop.
Save luzfcb/226612d0b98dd4493f9d to your computer and use it in GitHub Desktop.
# basically is this:
from django.db import models
from django.utils import timezone
from django.conf import settings
USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Document(models.Model):
content = models.TextField(blank=True)
created_at = models.DateTimeField(default=timezone.now, blank=True, editable=False)
created_by = models.ForeignKey(to=USER_MODEL,
related_name="%(app_label)s_%(class)s_created_by", null=True,
blank=True, on_delete=models.SET_NULL)
modified_at = models.DateField(auto_now=True, blank=True, editable=False)
modified_by = models.ForeignKey(to=USER_MODEL,
related_name="%(app_label)s_%(class)s_modified_by", null=True,
blank=True, on_delete=models.SET_NULL)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment