diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-03-23 00:58:26 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-03-23 00:58:26 -0400 |
commit | ebf0a342cd869e983ab63fe882d4f7ae87778ef8 (patch) | |
tree | 80bbcd3addf985b951aa69f7228eb1285d2d76e0 | |
parent | de09ca2920edb24f8cedf34b795d5870cd9aeb0a (diff) | |
download | askbot-ebf0a342cd869e983ab63fe882d4f7ae87778ef8.tar.gz askbot-ebf0a342cd869e983ab63fe882d4f7ae87778ef8.tar.bz2 askbot-ebf0a342cd869e983ab63fe882d4f7ae87778ef8.zip |
added user and date info to the full thread summary in the email response
-rw-r--r-- | askbot/const/__init__.py | 1 | ||||
-rw-r--r-- | askbot/models/__init__.py | 2 | ||||
-rw-r--r-- | askbot/models/post.py | 15 |
3 files changed, 15 insertions, 3 deletions
diff --git a/askbot/const/__init__.py b/askbot/const/__init__.py index ecd6df68..11fc8655 100644 --- a/askbot/const/__init__.py +++ b/askbot/const/__init__.py @@ -19,6 +19,7 @@ CLOSE_REASONS = ( ) LONG_TIME = 60*60*24*30 #30 days is a lot of time +DATETIME_FORMAT = '%I:%M %p, %d %b %Y' TYPE_REPUTATION = ( (1, 'gain_by_upvoted'), diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index c5e8c46f..6a091db0 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -2377,7 +2377,7 @@ def format_instant_notification_email( #add indented summaries for the parent posts content_preview += post.format_for_email_as_parent_thread_summary() - content_preview += '======= Full thread summary =======' + content_preview += '<p>======= Full thread summary =======</p>' content_preview += post.thread.format_for_email() diff --git a/askbot/models/post.py b/askbot/models/post.py index 0cc7b0ac..82102e4e 100644 --- a/askbot/models/post.py +++ b/askbot/models/post.py @@ -592,18 +592,28 @@ class Post(models.Model): ) % { 'user': parent_post.author.username, 'post': _(parent_post.post_type), - 'date': parent_post.added_at.strftime('%I:%M %p, %d %b %Y') + 'date': parent_post.added_at.strftime(const.DATETIME_FORMAT) } output += parent_post.format_for_email(quote_level = quote_level) current_post = parent_post return output + def format_for_email_as_metadata(self): + output = _( + 'Posted by %(user)s on %(date)s' + ) % { + 'user': self.author.username, + 'date': self.added_at.strftime(const.DATETIME_FORMAT) + } + return '<p>%s</p>' % output + def format_for_email_as_subthread(self): """outputs question or answer and all it's comments returns empty string for all other post types """ if self.post_type in ('question', 'answer'): - output = self.format_for_email() + output = self.format_for_email_as_metadata() + output += self.format_for_email() comments = self.get_cached_comments() if comments: comments_heading = ungettext( @@ -613,6 +623,7 @@ class Post(models.Model): ) % {'count': len(comments)} output += '<p>%s</p>' % comments_heading for comment in comments: + output += comment.format_for_email_as_metadata() output += comment.format_for_email(quote_level = 1) return output else: |