Ejemplo n.º 1
0
 def save(self):
     # If the object already existed, it will already have an id
     if not self.id:
         # This is a new object, set the creator
         self.created_by = threadlocals.get_current_user()
         self.created_at = datetime.now()
     # All articles need the edited by and edited at fields setting
     self.last_edited_by = threadlocals.get_current_user()
     self.last_edited_at = datetime.now()
     super(Article, self).save()
Ejemplo n.º 2
0
    def save(self):
        # If the object already existed, it will already have an id
        if not self.id:
            # This is a new object, set the creator
            self.created_by = threadlocals.get_current_user()
            self.created_at = datetime.now()

        # Set a slug if one isn't already set
        if not self.slug:
            self.slug = slugify(self.name)
        super(Image, self).save()