Exemple #1
0
def public_profile_page(request,
                        username,
                        template_name='userportal/public_profile.html',
                        template_no_access_name='userportal/profile_no_access.html'):

    user = get_object_or_404(SUser, username=username)
    privacy, created = UserPrivacy.objects.get_or_create(user=user)

    own_profile = False

    if privacy.public_profile:
        handler = profile_page_processors.get_handler(request, user)
        add_to_profile = handler.view(own_profile)

        return render(request,
                      template_name,
                      {
                          'viewed_user': user,
                          'privacy': privacy,
                          'add_to_profile': add_to_profile
                      })

    else:
        return render(request,
                      template_no_access_name,
                      {
                          'username': user.username
                      })
Exemple #2
0
def profile(request,
            template_name='userportal/profile.html'):

    user = request.user
    privacy = UserPrivacy.full_access()

    own_profile = True
    own_privacy, created = UserPrivacy.objects.get_or_create(user=user)

    handler = profile_page_processors.get_handler(request, user)
    add_to_profile = handler.view(own_profile)

    return render(request,
                  template_name,
                  {
                      'viewed_user': user,
                      'privacy': privacy,
                      'own_privacy': own_privacy,
                      'add_to_profile': add_to_profile
                  })