How to use the pin.tools.userdata_cache 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 / api.py View on Github external
im = get_thumbnail(o_image, "300x300", quality=99, upscale=False)
        except:
            im = ""

        if im:
            bundle.data['thumbnail'] = im
            bundle.data['hw'] = "%sx%s" % (im.height, im.width)

        if self.cur_user:
            if Likes.objects.filter(post_id=bundle.data['post_id'],
                                    user=self.cur_user).count():
                bundle.data['like_with_user'] = True

        post_owner_id = bundle.data['post_owner_id']

        bundle.data['post_owner_avatar'] = userdata_cache(post_owner_id, CACHE_AVATAR)
        bundle.data['post_owner_user_name'] = userdata_cache(post_owner_id, CACHE_USERNAME)

        actors = Notif_actors.objects.filter(notif=id).order_by('id')[:10]
        ar = []
        for lk in actors:
            ar.append(
                [
                    lk.actor.id,
                    get_username(lk.actor),
                    daddy_avatar.get_avatar(lk.actor, size=100)
                ]
            )

        bundle.data['actors'] = ar

        return bundle
github vchakoshy / django-pin / pin / api.py View on Github external
except:
            im = ""

        if im:
            bundle.data['thumbnail'] = im
            bundle.data['hw'] = "%sx%s" % (im.height, im.width)

        if self.cur_user:
            if Likes.objects.filter(post_id=bundle.data['post_id'],
                                    user=self.cur_user).count():
                bundle.data['like_with_user'] = True

        post_owner_id = bundle.data['post_owner_id']

        bundle.data['post_owner_avatar'] = userdata_cache(post_owner_id, CACHE_AVATAR)
        bundle.data['post_owner_user_name'] = userdata_cache(post_owner_id, CACHE_USERNAME)

        actors = Notif_actors.objects.filter(notif=id).order_by('id')[:10]
        ar = []
        for lk in actors:
            ar.append(
                [
                    lk.actor.id,
                    get_username(lk.actor),
                    daddy_avatar.get_avatar(lk.actor, size=100)
                ]
            )

        bundle.data['actors'] = ar

        return bundle
github vchakoshy / django-pin / pin / templatetags / pin_tags.py View on Github external
@register.filter
def get_userdata_name(user, size=30):
    return userdata_cache(user, 1)
github vchakoshy / django-pin / pin / api.py View on Github external
def dehydrate(self, bundle):
        user = bundle.data['user_url']

        bundle.data['user_avatar'] = userdata_cache(user, CACHE_AVATAR)
        bundle.data['user_name'] = userdata_cache(user, CACHE_USERNAME)
        return bundle
github vchakoshy / django-pin / pin / templatetags / pin_tags.py View on Github external
@register.filter
def get_userdata_avatar(user, size=30):
    #print "size is: ",  user, size
    return userdata_cache(user, 0, size=size)
github vchakoshy / django-pin / pin / api.py View on Github external
def dehydrate(self, bundle):
        user = bundle.data['user']
        bundle.data['user_avatar'] = userdata_cache(user, CACHE_AVATAR, size=300)
        return bundle
github vchakoshy / django-pin / pin / api.py View on Github external
def dehydrate(self, bundle):
        user = bundle.data['user_url']

        bundle.data['user_avatar'] = userdata_cache(user, CACHE_AVATAR)
        bundle.data['user_name'] = userdata_cache(user, CACHE_USERNAME)
        return bundle