Exemple #1
0
def profile_view(request, username):
    profile = get_object_or_404(UserProfile, username=username)
    if profile.deleted:
        messages.error(request, _('This user account was deleted.'))
        return http.HttpResponseRedirect(reverse('users_user_list'))
    current_projects = profile.get_current_projects()
    following = profile.following()
    followers = profile.followers()
    links = Link.objects.filter(user=profile, project__isnull=True).order_by('index')
    activities = Activity.objects.for_user(profile)
    old_participations = Pleft_on__isnull=True
    past_projects = profile.get_past_projects()
    past_drupal_courses = projects_drupal.get_past_courses(profile.username)
    past_involvement_count = len(past_projects) + len(past_drupal_courses)
    pilot_badges = badges.get_awarded_badges(profile.username)
    return render_to_response('users/profile.html', {
        'profile': profile,
        'current_projects': current_projects,
        'following': following,
        'followers': followers,
        # TODO: enable when addition/edition of tags is implemented.
        # 'skills': profile.tags.filter(category='skill'),
        # 'interests': profile.tags.filter(category='interest'),
        'links': links,
        'activities': activities,
        'past_projects': past_projects,
        'past_drupal_courses': past_drupal_courses,
        'past_involvement_count': past_involvement_count,
        'pilot_badges': pilot_badges,
    }, context_instance=RequestContext(request))
Exemple #2
0
def profile_info(context):
    profile = context['profile']

    current_projects = profile.get_current_projects(only_public=True)
    users_following = profile.following()
    users_followers = profile.followers()

    interests = profile.tags.filter(category='interest').exclude(
        slug='').order_by('name')
    desired_topics = profile.tags.exclude(slug='').filter(
        category='desired_topic').order_by('name')
    skills = profile.tags.filter(category='skill').exclude(
        slug='').order_by('name')
    past_projects = profile.get_past_projects(only_public=True)
    past_drupal_courses = projects_drupal.get_past_courses(
        profile.username)
    past_involvement_count = len(past_projects) + len(past_drupal_courses)
    badges = get_awarded_badges(profile.user).values()
    badges_count = len(badges)

    context.update({
        'current_projects': current_projects,
        'users_following': users_following,
        'users_followers': users_followers,
        'skills': skills,
        'interests': interests,
        'desired_topics': desired_topics,
        'past_projects': past_projects,
        'past_drupal_courses': past_drupal_courses,
        'past_involvement_count': past_involvement_count,
        'badges': badges,
        'badges_count': badges_count,
    })
    return context
Exemple #3
0
def profile_view(request, username):
    profile = get_object_or_404(UserProfile, username=username)
    current_projects = profile.get_current_projects()
    following = profile.following()
    followers = profile.followers()
    links = Link.objects.filter(user=profile,
                                project__isnull=True).order_by('index')
    activities = Activity.objects.for_user(profile)
    old_participations = Pleft_on__isnull = True
    past_projects = profile.get_past_projects()
    past_drupal_courses = projects_drupal.get_past_courses(profile.username)
    past_involvement_count = len(past_projects) + len(past_drupal_courses)
    pilot_badges = badges.get_awarded_badges(profile.username)
    return render_to_response(
        'users/profile.html',
        {
            'profile': profile,
            'current_projects': current_projects,
            'following': following,
            'followers': followers,
            # TODO: enable when addition/edition of tags is implemented.
            # 'skills': profile.tags.filter(category='skill'),
            # 'interests': profile.tags.filter(category='interest'),
            'links': links,
            'activities': activities,
            'past_projects': past_projects,
            'past_drupal_courses': past_drupal_courses,
            'past_involvement_count': past_involvement_count,
            'pilot_badges': pilot_badges,
        },
        context_instance=RequestContext(request))
Exemple #4
0
def profile_info(context):
    profile = context['profile']

    current_projects = profile.get_current_projects(only_public=True)
    users_following = profile.following()
    users_followers = profile.followers()

    interests = profile.tags.filter(category='interest').exclude(
        slug='').order_by('name')
    desired_topics = profile.tags.exclude(slug='').filter(
        category='desired_topic').order_by('name')
    skills = profile.tags.filter(category='skill').exclude(
        slug='').order_by('name')
    past_projects = profile.get_past_projects(only_public=True)
    past_drupal_courses = projects_drupal.get_past_courses(profile.username)
    past_involvement_count = len(past_projects) + len(past_drupal_courses)
    badges = get_awarded_badges(profile.user).values()
    badges_count = len(badges)

    context.update({
        'current_projects': current_projects,
        'users_following': users_following,
        'users_followers': users_followers,
        'skills': skills,
        'interests': interests,
        'desired_topics': desired_topics,
        'past_projects': past_projects,
        'past_drupal_courses': past_drupal_courses,
        'past_involvement_count': past_involvement_count,
        'badges': badges,
        'badges_count': badges_count,
    })
    return context
Exemple #5
0
def profile_view(request, username):
    profile = get_object_or_404(UserProfile, username=username)
    if profile.deleted:
        messages.error(request, _('This user account was deleted.'))
        return http.HttpResponseRedirect(reverse('users_user_list'))
    current_projects = profile.get_current_projects(only_public=True)
    following = profile.following()
    followers = profile.followers()
    skills = profile.tags.filter(category='skill').order_by('name')
    interests = profile.tags.filter(category='interest').order_by('name')
    desired_topics = profile.tags.filter(
        category='desired_topic').order_by('name')
    links = Link.objects.filter(user=profile,
        project__isnull=True).order_by('index')
    activities = Activity.objects.for_user(profile)
    past_projects = profile.get_past_projects(only_public=True)
    past_drupal_courses = projects_drupal.get_past_courses(profile.username)
    past_involvement_count = len(past_projects) + len(past_drupal_courses)
    pilot_badges = badges.get_awarded_badges(profile.username)
    return render_to_response('users/profile.html', {
        'profile': profile,
        'current_projects': current_projects,
        'following': following,
        'followers': followers,
        'skills': skills,
        'interests': interests,
        'desired_topics': desired_topics,
        'links': links,
        'activities': activities,
        'past_projects': past_projects,
        'past_drupal_courses': past_drupal_courses,
        'past_involvement_count': past_involvement_count,
        'pilot_badges': pilot_badges,
        'domain': Site.objects.get_current().domain,
    }, context_instance=RequestContext(request))
Exemple #6
0
def user_sidebar(context, max_people_count=64):
    profile = context['profile']
    profile_view = context['profile_view']

    current_projects = profile.get_current_projects(only_public=profile_view)
    users_following = profile.following()
    users_followers = profile.followers()

    interests = profile.tags.filter(category='interest').exclude(
        slug='').order_by('name')
    desired_topics = profile.tags.exclude(slug='').filter(
        category='desired_topic').order_by('name')

    links = Link.objects.filter(user=profile,
        project__isnull=True).order_by('index')

    # only display non actionable items on the profile.
    skills = past_projects = past_drupal_courses = badges = pilot_badges = []
    past_involvement_count = badges_count = 0
    if profile_view:
        skills = profile.tags.filter(category='skill').exclude(
            slug='').order_by('name')
        past_projects = profile.get_past_projects(only_public=profile_view)
        past_drupal_courses = projects_drupal.get_past_courses(
            profile.username)
        past_involvement_count = len(past_projects) + len(past_drupal_courses)
        pilot_badges = get_awarded_badges(profile.user).values()
        badge_awards = Award.objects.filter(
            user=profile).values('badge_id')
        badges = Badge.objects.filter(id__in=badge_awards)
        badges_count = len(pilot_badges) + badges.count()

    context.update({
        'current_projects': current_projects,
        'users_following': users_following,
        'users_followers': users_followers,
        'skills': skills,
        'interests': interests,
        'desired_topics': desired_topics,
        'links': links,
        'past_projects': past_projects,
        'past_drupal_courses': past_drupal_courses,
        'past_involvement_count': past_involvement_count,
        'badges': badges,
        'pilot_badges': pilot_badges,
        'badges_count': badges_count,
    })
    return context
Exemple #7
0
def profile_view(request, username):
    profile = get_object_or_404(UserProfile, username=username)
    if profile.deleted:
        messages.error(request, _('This user account was deleted.'))
        return http.HttpResponseRedirect(reverse('users_user_list'))
    current_projects = profile.get_current_projects(only_public=True)
    following = profile.following()
    followers = profile.followers()
    skills = profile.tags.filter(category='skill').order_by('name')
    interests = profile.tags.filter(category='interest').order_by('name')
    desired_topics = profile.tags.filter(
        category='desired_topic').order_by('name')
    links = Link.objects.filter(user=profile,
                                project__isnull=True).order_by('index')
    activities = Activity.objects.for_user(profile)
    past_projects = profile.get_past_projects(only_public=True)
    past_drupal_courses = projects_drupal.get_past_courses(profile.username)
    past_involvement_count = len(past_projects) + len(past_drupal_courses)
    pilot_badges = badges.get_awarded_badges(profile.username)
    return render_to_response('users/profile.html', {
        'profile': profile,
        'current_projects': current_projects,
        'following': following,
        'followers': followers,
        'skills': skills,
        'interests': interests,
        'desired_topics': desired_topics,
        'links': links,
        'activities': activities,
        'past_projects': past_projects,
        'past_drupal_courses': past_drupal_courses,
        'past_involvement_count': past_involvement_count,
        'pilot_badges': pilot_badges,
        'domain': Site.objects.get_current().domain,
    },
                              context_instance=RequestContext(request))