How to use the pin.models.Likes.objects.filter function in pin

To help you get started, we’ve selected a few pin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vchakoshy / django-pin / pin / templatetags / pin_tags.py View on Github external
def render(self, context):
        try:
            item = int(self.item.resolve(context))
            user = context['user']
            liked = pin_likes.objects.filter(user=user, post=item).count()
            if liked:
                return 'btn-danger'
            else:
                return ''
        except template.VariableDoesNotExist:
            return ''