Mercurial > public > sg101
diff news/models.py @ 998:e2c3d7ecfa30
Added tests for submit news.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 20 Nov 2015 23:07:37 -0600 |
parents | 19b86e684cc2 |
children | 8386a8ebcbc7 |
line wrap: on
line diff
--- a/news/models.py Tue Nov 17 21:01:20 2015 -0600 +++ b/news/models.py Fri Nov 20 23:07:37 2015 -0600 @@ -37,7 +37,7 @@ submitter = models.ForeignKey(User) category = models.ForeignKey(Category) short_text = models.TextField() - long_text = models.TextField(blank=True) + long_text = models.TextField(default='', blank=True) date_submitted = models.DateTimeField(db_index=True) allow_comments = models.BooleanField(default=True) tags = TagField() @@ -60,12 +60,12 @@ else: self.update_date = datetime.datetime.now() - self.short_text = kwargs.pop('short_text', None) - if self.short_text is None and self.short_markup: + self.short_text = kwargs.pop('short_text', '') + if not self.short_text and self.short_markup: self.short_text = site_markup(self.short_markup) - self.long_text = kwargs.pop('long_text', None) - if self.long_text is None and self.long_markup: + self.long_text = kwargs.pop('long_text', '') + if not self.long_text and self.long_markup: self.long_text = site_markup(self.long_markup) super(StoryBase, self).save(*args, **kwargs)