예제 #1
0
def profile(request, UserName):
    if not request.user.is_authenticated():
        return denied(request)

    Dict = {}

    for setting in UserCustomSettings.objects.filter(user=request.user):
        if setting.value != "no":
            Dict[setting.setting.title] = True
            Dict[setting.setting.title + "_value"] = setting.value

    if request.user.username == UserName:
        t = loader.get_template("profile.html")
        Dict = setup_user_menu(request.user, Dict)
        Class = UserCustomSettings.objects.get(user=request.user,
                                               setting__title="class")
        Identity = UserCustomSettings.objects.get(user=request.user,
                                                  setting__title="identity")
        Res = ApiKeys.objects.get(user=request.user)
        Dict["public_key_api"] = Res.public_key
        Dict["class_value"] = Class.value
        Dict["identity_value"] = Identity.value
        DealComis = format_numbers4(
            Decimal(Dict["deal_comission_value"]) * Decimal("100"))
        request.session["deal_comission_show"] = DealComis
        request.session["deal_comission"] = format_numbers4(
            Decimal(Dict["deal_comission_value"]))
        Dict["deal_comission_value"] = DealComis

        Dict["is_own_profile"] = True
        Dict["client"] = request.user
        return http_tmpl_context(request, t, Dict)
    else:
        t = loader.get_template("profile.html")
        Dict = setup_user_menu(request.user)
        try:
            usr = User.objects.get(username=UserName)
            Class = UserCustomSettings.objects.get(user=usr,
                                                   setting__title="class")
            Dict["client"] = usr
            Dict["class_value"] = Class.value

        except:
            return denied(request)

        Dict["is_own_profile"] = False

        return http_tmpl_context(request, t, Dict)
예제 #2
0
def profile(request, UserName):
   if not request.user.is_authenticated():
          return denied(request)
  
   Dict = {}

   for setting  in UserCustomSettings.objects.filter(user  = request.user):
           if setting.value != "no":
                        Dict[ setting.setting.title ]  = True
                        Dict[ setting.setting.title +"_value" ]  = setting.value
                        
   if request.user.username == UserName:
          t = loader.get_template("profile.html")   
          Dict = setup_user_menu(request.user, Dict)
          Class  = UserCustomSettings.objects.get(user  = request.user, setting__title="class")
          Identity  = UserCustomSettings.objects.get(user  = request.user, setting__title="identity")
          Res =  ApiKeys.objects.get(user = request.user)
          Dict["public_key_api"] = Res.public_key
          Dict["class_value"] = Class.value
          Dict["identity_value"] = Identity.value
          DealComis =  format_numbers4( Decimal(Dict["deal_comission_value"])*Decimal("100") )
          request.session["deal_comission_show"] = DealComis
          request.session["deal_comission"] = format_numbers4( Decimal(Dict["deal_comission_value"]))
          Dict["deal_comission_value"] = DealComis
          

          
          Dict["is_own_profile"] = True
          Dict["client"] = request.user
          return http_tmpl_context(request, t, Dict)    
   else:
          t = loader.get_template("profile.html")
          Dict = setup_user_menu(request.user)
          try:
                usr = User.objects.get(username  = UserName)
                Class  = UserCustomSettings.objects.get(user  = usr, setting__title="class")
                Dict["client"] = usr
                Dict["class_value"] = Class.value

          except :
                return denied(request)                
                
          Dict["is_own_profile"] = False

          return http_tmpl_context(request, t, Dict) 
예제 #3
0
파일: views.py 프로젝트: perldev/processing
def user_panel(request, Title="btc_uah"):
    if not request.user.is_authenticated():
        return HttpResponse("very_bad")
    else:
        Current = TradePairs.objects.get(url_title=Title)
        t = loader.get_template("mobile_user_menu.html")

        Dict = setup_user_menu(request.user)
        Dict["is_user"] = True
        Dict["Currency"] = Current.currency_on.title
        Dict["Currency1"] = Current.currency_from.title
        c = Context(Dict)
        return HttpResponse(t.render(c))
예제 #4
0
파일: views.py 프로젝트: kostyll/stock2
def user_panel(request, Title="btc_uah"):
    if not request.user.is_authenticated():
        return HttpResponse("very_bad")
    else:
        Current = TradePairs.objects.get(url_title=Title)
        t = loader.get_template("mobile_user_menu.html")

        Dict = setup_user_menu(request.user)
        Dict["is_user"] = True
        Dict["Currency"] = Current.currency_on.title
        Dict["Currency1"] = Current.currency_from.title
        c = Context(
            Dict
        )
        return HttpResponse(t.render(c))