Commits

Anonymous committed 4ae7cce

added autouser recog via django-globals

  • Participants
  • Parent commits b4b97c6

Comments (0)

Files changed (1)

File content_item_base/models.py

 from django.db import models
 from django.contrib.auth.models import User
 from tagging.fields import TagField
+from django_globals import globals
 
 class LiveItemManager(models.Manager):
     def get_query_set(self): 
     title = models.CharField(max_length=250, help_text="Maximum 250 characters.")
     slug = models.SlugField(unique_for_date='publish', help_text="Suggested value automatically generated from title. Must be unique.")
     
-    author = models.ForeignKey(User)
+    author = models.ForeignKey(User, default=lambda: globals.user)
     
     created = models.DateTimeField(editable=False)
     updated = models.DateTimeField(editable=False)
         if not self.id:
             self.created = datetime.datetime.today()
         self.updated = datetime.datetime.today()
+        self.user = globals.user
         super(ContentItemBase, self).save()