Example #1
0
    def get(self, request):

        try:

            user_id = request.session.get('fb_id', False)
            user = User.objects.get(id=user_id)

            if user.meta == None:
                return HttpResponseRedirect('/registrar/')

            try:
                user.name = user.name.split(' ')[0]
            except: pass

            wall = WallController()


            RES = {
                'USER': user,
                "WALL": wall.get_public_wall(user, 0, 10),
                'CIGARETTES': Cigarette.objects.all()
            }
            return render_to_response(
                'home.tpl',
                RES,
                context_instance = RequestContext(request)
            )
        except Exception, er:
            print er
            return render_to_response(
                'landing.tpl',
                context_instance = RequestContext(request)
            )
Example #2
0
 def get(self, request):
     wall = WallController()
     if request.GET.get('page','home') != 'profile':
         wall = wall.get_public_wall(request.USER)
     else:
         try:
             profile = User.objects\
                         .filter(username=request.GET['username'])\
                         .exclude(meta=None)[0]
         except Exception, err:
             raise Http404
         is_friend = profile.friends.filter(id=request.USER.id).count()
         if profile.id==request.USER.id:
             privacy = '1,2,3'
         elif is_friend:
             privacy = '2,3'
         else:
             privacy = '2'
         wall = wall.get_single_user_wall(profile,privacy)
Example #3
0
    is_owner = False
    if profile.id==user_logged_id:
        is_owner = True
        privacy = '1,2,3'
    elif is_friend:
        privacy = '2,3'
    else:
        privacy = '2'


    try:
        profile.name = profile.name.split(' ')[0]
    except: pass

    wall = WallController()

    

    RES = {
        'USER': profile,
        "WALL": wall.get_single_user_wall(profile,privacy, 0, 10),
        'IS_OWNER': is_owner,
        'IS_FRIEND': is_friend
    }

    return render_to_response(
        'profile.tpl',
        RES,
        context_instance = RequestContext(request)
    )