def get_old_message(self, record, user): data = ActivityMessageDict(record) if team is None: return format_html( mark_safe(_('removed <a href="{video_url}">{video}</a> from {team}')), video=data.video, video_url=data.video_url, team=data.team ) elif user is not None and can_view_activity(team, user): to_team_url = reverse('teams:dashboard', args=(team.slug,)) return format_html( mark_safe(_('moved <a href="{video_url}">{video}</a> from {team} to ' '<a href="{to_team_url}">{to_team}</a>')), to_team_url=to_team_url, to_team=team.name, video=data.video, video_url=data.video_url, team=data.team ) else: return format_html( mark_safe(_('moved <a href="{video_url}">{video}</a> from {team} to ' 'another team')), video=data.video, video_url=data.video_url, team=data.team )
def get_message(self, record, user): team = record.get_related_obj() if team is None: msg = _( 'removed <a href="%(video_url)s">%(video)s</a> from %(from_team)s' ) to_team_name = None to_team_url = None elif can_view_activity(team, user): msg = _( 'moved <a href="%(video_url)s">%(video)s</a> from %(from_team)s to <a href="%(to_team_url)s">%(to_team_name)s</a>' ) to_team_name = team.name to_team_url = reverse('teams:dashboard', args=(team.slug, )) else: msg = _( 'moved <a href="%(video_url)s">%(video)s</a> from %(from_team)s to another team' ) to_team_name = None to_team_url = None return self.format_message(record, msg, from_team=record.team.name, to_team_name=to_team_name, to_team_url=to_team_url)
def get_message(self, record, user): data = ActivityMessageDict(record) team = record.get_related_obj() if team is None: return format_html( mark_safe(_('<strong>{user}</strong> removed <a href="{video_url}">{video}</a>' ' from {team}')), user=data.user, video=data.video, video_url=data.video_url, team=data.team ) elif user is not None and can_view_activity(team, user): to_team_url = reverse('teams:dashboard', args=(team.slug,)) return format_html( mark_safe(_('<strong>{user}</strong> moved <a href="{video_url}">{video}</a>' ' from {team} to <a href="{to_team_url}">{to_team}</a>')), to_team_url=to_team_url, to_team=team.name, user=data.user, video=data.video, video_url=data.video_url, team=data.team ) else: return format_html( mark_safe(_('<strong>{user}</strong> moved <a href="{video_url}">{video}</a>' ' from {team} to another team')), user=data.user, video=data.video, video_url=data.video_url, team=data.team )