def make_article(self): a = Article() a.title = 'Test title' a.text = 'This should be a very long text with <html> in it as well.' a.post = self.m a.save() return a
def putWeekReport(report, newsletter): # if nothing changed, nothing to report, moving on. if report['db_changes'] == None and report[ 'discussion'] == None and report['characteristic'] == None: return now = timezone.now() mess = Message(title=newsletter.title + " - Recent Changes - " + now.strftime("%Y-%m-%d %H:%M"), slug=newsletter.slug + '_' + now.strftime("%Y%m%d%H%M%S"), newsletter=newsletter) mess.save() if report['db_changes'] != None: art = Article(title="Changes on Database:", text=report['db_changes'], post=mess) art.save() if report['discussion'] != None: art2 = Article(title="New Discussion:", text=report['discussion'], post=mess) art2.save() if report['characteristic'] != None: art3 = Article(title="New Population Characteristic Data:", text=report['characteristic'], post=mess) art3.save() subm = Submission.from_message(mess) subm.prepared = True subm.save()