Ejemplo n.º 1
0
    def save(self, *args, **kwargs):
        ''' On save, clean HTML '''
        self.body = clean_html(self.body)
        if not self.id:
            self.created = datetime.datetime.now()
    
        if self.id:            
            if not self.byline or self.byline == "" and self.authors:
                self.byline = self.get_authors_as_text()
                
        if not self.byline:
            self.byline = "Rhizome"

        # slack integration
        if self.status == Post.PUBLIC and self.status != self.old_status:
            self.old_status = self.status
            payload = None

            if self.publish <= datetime.datetime.now():
                payload = {'text': 'New post published: <%s%s|%s>' % ('http://rhizome.org', self.get_absolute_url(), self.title), 'unfurl_links': True}
            else:
                payload = {'text': 'New post scheduled for publication at %s: <%s%s|%s>' % (self.publish.strftime('%b %d %I:%M %p'), 'http://rhizome.org', self.get_absolute_url(), self.title), 'unfurl_links': True}

            requests.post(settings.SLACK_WEBHOOK_URL, data=json.dumps(payload))


        super(Post, self).save(*args, **kwargs)
Ejemplo n.º 2
0
 def save(self, *args, **kwargs):
     ''' On save, clean HTML '''
     self.body = clean_html(self.body)
     if not self.id:
         self.created = datetime.datetime.now()
 
     if self.id:            
         if not self.byline or self.byline == "" and self.authors:
             self.byline = self.get_authors_as_text()
             
     if not self.byline:
         self.byline = "Rhizome"
     super(Post, self).save(*args, **kwargs)
Ejemplo n.º 3
0
    def save(self, *args, **kwargs):
        ''' On save, clean HTML '''
        self.body = clean_html(self.body)
        if not self.id:
            self.created = datetime.datetime.now()

        if self.id:
            if not self.byline or self.byline == "" and self.authors:
                self.byline = self.get_authors_as_text()

        if not self.byline:
            self.byline = "Rhizome"
        super(Post, self).save(*args, **kwargs)
Ejemplo n.º 4
0
 def save(self, *args, **kwargs):
     ''' On save, clean HTML '''
     self.mission = clean_html(self.mission)
     self.archival_process = clean_html(self.archival_process)
     self.access_membership = clean_html(self.access_membership)
     self.philosophy = clean_html(self.philosophy)
     self.selection_criteria = clean_html(self.selection_criteria)
     self.current_projects = clean_html(self.current_projects)
     super(AboutArtbase, self).save(*args, **kwargs)
Ejemplo n.º 5
0
 def save(self, *args, **kwargs):
     ''' On save, clean HTML '''
     self.mission = clean_html(self.mission)
     self.archival_process = clean_html(self.archival_process)
     self.access_membership = clean_html(self.access_membership)
     self.philosophy = clean_html(self.philosophy)
     self.selection_criteria = clean_html(self.selection_criteria)
     self.current_projects = clean_html(self.current_projects)
     super(AboutArtbase, self).save(*args, **kwargs)
Ejemplo n.º 6
0
    def save(self, *args, **kwargs):
        ''' On save, clean HTML '''
        self.body = clean_html(self.body)
        if not self.id:
            self.created = datetime.datetime.now()

        if self.id:
            if not self.byline or self.byline == "" and self.authors:
                self.byline = self.get_authors_as_text()

        if not self.byline:
            self.byline = "Rhizome"

        # slack integration
        if self.status == Post.PUBLIC and self.status != self.old_status:
            self.old_status = self.status
            payload = None

            if self.publish <= datetime.datetime.now():
                payload = {
                    'text':
                    'New post published: <%s%s|%s>' %
                    ('http://rhizome.org', self.get_absolute_url(),
                     self.title),
                    'unfurl_links':
                    True
                }
            else:
                payload = {
                    'text':
                    'New post scheduled for publication at %s: <%s%s|%s>' %
                    (self.publish.strftime('%b %d %I:%M %p'),
                     'http://rhizome.org', self.get_absolute_url(),
                     self.title),
                    'unfurl_links':
                    True
                }

            requests.post(settings.SLACK_WEBHOOK_URL, data=json.dumps(payload))

        super(Post, self).save(*args, **kwargs)
Ejemplo n.º 7
0
 def save(self, *args, **kwargs):
     """ On save, clean HTML """
     self.excerpt = clean_html(self.excerpt)
     self.article_full_text = clean_html(self.article_full_text)
     super(Press, self).save(*args, **kwargs)
Ejemplo n.º 8
0
 def save(self, *args, **kwargs):
     """ On save, clean HTML """
     self.bio = clean_html(self.bio)
     super(StaffMember, self).save(*args, **kwargs)
Ejemplo n.º 9
0
 def save(self, *args, **kwargs):
     ''' On save, update timestamps '''
     self.body = clean_html(self.body)
     if not self.id:
         self.created = datetime.datetime.now()
     super(MemberNewsletter, self).save(*args, **kwargs)
Ejemplo n.º 10
0
 def save(self, *args, **kwargs):
     ''' On save, update timestamps '''
     self.body = clean_html(self.body)
     if not self.id:
         self.created = datetime.datetime.now()
     super(MemberNewsletter, self).save(*args, **kwargs)