Пример #1
0
 def get_type(self, obj):
     # not in Action.type-property because Action is an external module
     verb_slug = get_verb_slug(obj.action_object, obj.verb)
     if verb_slug in ['item-commented']:
         return 'item-comment'
     elif verb_slug in ['revision-added-review-session-comment', 'revision-added-revision-comment']:
         return 'revision-comment'
     else:
         return 'default'
Пример #2
0
    def get_event(self, obj):
        """
        Is used on notifications-page and works similar to notice_tags:
        - load verb_slug and decide on this (-> ACTIVITY_TEMPLATES) which template is used
        - fill ctx with needed data
        """
        verb_slug = get_verb_slug(obj.action_object, obj.verb)

        template = self._get_template(verb_slug)
        context = Context(self._get_context(obj, verb_slug))

        # render the template with passed in context
        return template.render(context)