def show_profile(context, profile): if isinstance(profile, GenericReference): profile = profile.obj try: homehub = profile.homeplace.tggroup_set.filter(level="member")[0] except: homehub = TgGroup.objects.get(id=1) # profile = TemplateSecureWrapper(secure_wrap(profile, context['request'].user, interface_names=['Viewer'], required_interfaces=['Viewer'])) user = profile.user return {"homehub": homehub, "profile": profile, "user": user, "main_hub_name": main_hub_name()}
def show_profile(context, profile): if isinstance(profile, GenericReference): profile = profile.obj if profile.homehub : homehub = profile.homehub else : from apps.plus_permissions.default_agents import get_all_members_group homehub = get_all_members_group() #profile = TemplateSecureWrapper(secure_wrap(profile, context['request'].user, interface_names=['Viewer'], required_interfaces=['Viewer'])) user = profile.user is_me, i_follow, follows_me = False, False, False if context['request'].user.username == user.username : is_me = True if context['request'].user : if context['request'].user.is_following(user) : i_follow = True if user.is_following(context['request'].user) : follows_me = True return {"homehub":homehub, "profile":profile, "user": user, "main_hub_name":main_hub_name(), "follows_me":follows_me, "i_follow":i_follow}