Exemple #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)
Exemple #2
0
def pin_change_do(Req):
    if not Req.user.is_authenticated():
             return denied(Req)
     
    Form = PinChangeForm(Req.POST,  user = Req.user)  
    Dict = {}
    
    if Form.is_valid():
          pin_name = settings.ROOT_PATH + "pins_images/pin_%i.png" % (Req.user.id)
          (Letters, Value) = pin(pin_name)
          i = None
          try:
                  i = PinsImages.objects.get(user = Req.user)
          except PinsImages.DoesNotExist:
                  i = PinsImages(user = Req.user,
                                 img = pin_name
                                 )
          
          i.req_vocabulary  = Letters
          i.hash_value = generate_key_from(Value, settings.PIN_SALT)
          i.operator = Req.user
          i.status = "processed"
          i.save()
                ##устанавливаем холд на вывод 
          Key = start_show_pin(Req.user.id, 160000)      
          return redirect( "/pin_image_page/%s" % (Key) ) 
    else :
        t = loader.get_template("simple_form.html")   
        Dict = {}
        Dict["form"] = Form.as_p()
        Dict["action"] = "/profile/pin_change_do"
        Dict["action_title"] = settings.pin_change_title
        Dict["pin_load"] = True
        return http_tmpl_context(Req, t, Dict)
Exemple #3
0
def forgot_action(request):
    Form = UsersForgotMail(request.POST)  
    Dict = {}
    if Form.is_valid():
# Save a new Article object from the form's data.
        hold = HoldsWithdraw(user = Form.user, hours =  settings.default_hold)
        hold.save()
        NewPwd = generate_key("hold")[10:30]
        #if settings.DEBUG is False:
        Email = Form.cleaned_data["email"]
        send_mail(_(u'Обновление пароля на сайте ' + settings.BASE_HOST),
                                   reset_pwd_mail(Form.user, NewPwd),
                                   settings.EMAIL_HOST_USER,
                                   [ Email ],
                                     fail_silently = False)       
                
        Form.user.set_password(NewPwd)
        Form.user.save()        
        return redirect("/forgot_success")                
    else :
        t = loader.get_template("simple_form.html")   
        Dict["title"] = settings.secondary_main_forgot    
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = settings.common_help_text   
        Dict["action"] = "/forgot_action"
        Dict["action_title"] = settings.reset_password_title
        return http_tmpl_context(request, t, Dict)    
Exemple #4
0
def crypto_currency_get_account(request, CurrencyTitle):
    CurrencyIn = Currency.objects.get(title=CurrencyTitle)
    # TODO add working with ref through Account class
    Crypton = CryptoAccount(CurrencyTitle, "")
    CurIns = Currency.objects.get(title = CurrencyTitle)
    tmpl = loader.get_template("new_addresses.html")
        
    bulk_add = []
    Addresses = {}
    try:               
        for i in xrange(1, 500):
            FreeAccount = PoolAccounts(currency = CurIns, status = "created")                      
            FreeAccount.pub_date = date.today() 
            NewAdress  = Crypton.getnewaddress()
            FreeAccount.address = NewAdress 

            try:
                FreeAccount.save()
                print "new address %s"  % NewAdress   
                bulk_add.append(NewAdress)
            except:
                print "repeat address %s" % (NewAdress)
    except:
        print "caught exception"
        traceback.print_exc()
    print "continue to work"    
    Dict  = {"addressess" : "\n".join(bulk_add) }
    return http_tmpl_context(request, tmpl, Dict)
Exemple #5
0
def crypto_balances(request, CurrencyTitle):
    ###TODO add generator
    CurrencyInstance = Currency.objects.get(title=CurrencyTitle)
    BalancesList = []
    for item in Balances.objects.filter(currency=CurrencyInstance).exclude(account="whole").order_by("-balance"):
        Cell = []
        Cell.append(item.account)
        Cell.append(format_numbers_strong(item.balance))
        BalancesList.append({"transes": Cell})

    paginator = Paginator(BalancesList, 200)  # Show 25 contacts per page

    page = request.GET.get('page', 1)
    try:
        BalancesListPage = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        BalancesListPage = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        BalancesListPage = paginator.page(paginator.num_pages)
    balance = Balances.objects.get(account="whole", currency=CurrencyInstance)
    Dict = {"trans_page_title": _(u"Балансы  {currency} - общий {balance}").format(currency=CurrencyTitle,
                                                                                   balance=format_numbers_strong(
                                                                                       balance.balance)),
            "paging": True,
            "Trans": BalancesListPage,
            "TransList": BalancesListPage.object_list,
            "TransTitle": [{"value": _(u"Адрес")}, {"value": _(u"Баланс")}]
    }
    tmpl = loader.get_template("common_trans_page.html")
    return http_tmpl_context(request, tmpl, Dict)
Exemple #6
0
def depmotion(request, CurrencyTitle):
    CurrencyList = Currency.objects.all()
    cur = Currency.objects.get(title=CurrencyTitle)
    (TransList, TransTitle) = (None, None)
    user_id = request.user.id
    if SDKCryptoCurrency.has_key(CurrencyTitle):
        ##TODO avoid this
        TransList = list(crypton_currency_list(user_id, CurrencyTitle))
        TransTitle = (
            {"value": _(u"Дебит/Кредит")},
            {"value": _(u"Адрес")},
            {"value": _(u"Сумма")},
            {"value": _(u"Дата")},
            {"value": _(u"Статус")},
            {"value": _(u"Подтверждения")},
            {"value": _(u"Txid")},
        )
    elif CurrencyTitle == "UAH":
        TransList = list(crypton_uah_list(user_id))
        TransTitle = (
            {"value": _(u"Дебит/Кредит")},
            {"value": _(u"Счет")},
            {"value": _(u"Сумма")},
            {"value": _(u"Дата")},
            {"value": _(u"Статус")},
        )
    else:
        TransList = list(crypton_emoney_list(user_id, cur))
        TransTitle = (
            {"value": _(u"Дебит/Кредит")},
            {"value": _(u"Сумма")},
            {"value": _(u"Дата")},
            {"value": _(u"Статус")},
        )

    TransListPage = None
    paginator = Paginator(TransList, 200)  # Show 25 contacts per page

    page = request.GET.get("page", 1)

    try:
        TransListPage = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        TransListPage = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        TransListPage = paginator.page(paginator.num_pages)
    # balance =  Balances.objects.get(account = "whole", currency = CurrencyInstance)

    Dict = {
        "paging": True,
        "current_trade": CurrencyTitle,
        "Trans": TransListPage,
        "TransList": TransListPage.object_list,
        "TransTitle": TransTitle,
        "CurrencyList": CurrencyList,
    }
    tmpl = loader.get_template("finance_depmotion_home.html")
    return http_tmpl_context(request, tmpl, Dict)
Exemple #7
0
def pin_change_do(Req):
    if not Req.user.is_authenticated():
        return denied(Req)

    Form = PinChangeForm(Req.POST, user=Req.user)
    Dict = {}

    if Form.is_valid():
        pin_name = settings.ROOT_PATH + "pins_images/pin_%i.png" % (
            Req.user.id)
        (Letters, Value) = pin(pin_name)
        i = None
        try:
            i = PinsImages.objects.get(user=Req.user)
        except PinsImages.DoesNotExist:
            i = PinsImages(user=Req.user, img=pin_name)

        i.req_vocabulary = Letters
        i.hash_value = generate_key_from(Value, settings.PIN_SALT)
        i.operator = Req.user
        i.status = "created"
        i.save()
        ##устанавливаем холд на вывод
        Key = start_show_pin(Req.user.id, 160000)
        return redirect("/pin_image_page/%s" % (Key))
    else:
        t = loader.get_template("simple_form.html")
        Dict = {}
        Dict["form"] = Form.as_p()
        Dict["action"] = "/profile/pin_change_do"
        Dict["action_title"] = settings.pin_change_title
        Dict["pin_load"] = True
        return http_tmpl_context(Req, t, Dict)
def forgot_action(request):
    Form = UsersForgotMail(request.POST)
    Dict = {}
    if Form.is_valid():
        # Save a new Article object from the form's data.

        SessionLink = generate_key("hold")[10:30]
        reset_link = ResetPwdLink(user=Form.user, key=SessionLink)
        reset_link.save()
        # if settings.DEBUG is False:
        Email = Form.cleaned_data["email"]

        main.msgs.send_mail(
            _(u"Обновление пароля на бирже " + settings.BASE_HOST),
            reset_pwd_mail(Form.user, SessionLink),
            settings.EMAIL_HOST_USER,
            [Email],
            fail_silently=False,
        )

        return redirect("/forgot_success")
    else:
        t = loader.get_template("simple_form_center.html")
        Dict["title"] = settings.secondary_main_forgot
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = settings.common_help_text
        Dict["action"] = "/forgot_action"
        Dict["action_title"] = settings.reset_password_title
        return http_tmpl_context(request, t, Dict)
Exemple #9
0
def crypto_balances(request, CurrencyTitle):
    ###TODO add generator
    CurrencyInstance = Currency.objects.get(title=CurrencyTitle)
    BalancesList = []
    for item in Balances.objects.filter(currency=CurrencyInstance).exclude(account="whole").order_by("-balance"):
        Cell = []
        Cell.append(item.account)
        Cell.append(format_numbers_strong(item.balance))
        BalancesList.append({"transes": Cell})

    paginator = Paginator(BalancesList, 200)  # Show 25 contacts per page

    page = request.GET.get('page', 1)
    try:
        BalancesListPage = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        BalancesListPage = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        BalancesListPage = paginator.page(paginator.num_pages)
    balance = Balances.objects.get(account="whole", currency=CurrencyInstance)
    Dict = {"trans_page_title": _(u"Балансы  {currency} - общий {balance}").format(currency=CurrencyTitle,
                                                                                   balance=format_numbers_strong(
                                                                                       balance.balance)),
            "paging": True,
            "Trans": BalancesListPage,
            "TransList": BalancesListPage.object_list,
            "TransTitle": [{"value": _(u"Адрес")}, {"value": _(u"Баланс")}]
    }
    tmpl = loader.get_template("common_trans_page.html")
    return http_tmpl_context(request, tmpl, Dict)
def forgot_action(request):
    Form = UsersForgotMail(request.POST)
    Dict = {}
    if Form.is_valid():
        # Save a new Article object from the form's data.

        SessionLink = generate_key("hold")[10:30]
        reset_link = ResetPwdLink(user=Form.user, key=SessionLink)
        reset_link.save()
        # if settings.DEBUG is False:
        Email = Form.cleaned_data["email"]

        main.msgs.send_mail(_(u'Обновление пароля на бирже ' + settings.BASE_HOST),
                            reset_pwd_mail(Form.user, SessionLink),
                            [Email],
                            fail_silently=False)

        return redirect("/forgot_success")
    else:
        t = loader.get_template("simple_form_center.html")
        Dict["title"] = settings.secondary_main_forgot
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = settings.common_help_text
        Dict["action"] = "/forgot_action"
        Dict["action_title"] = settings.reset_password_title
        return http_tmpl_context(request, t, Dict)
Exemple #11
0
def user_private_key(Req):
    Res =  ApiKeys.objects.get(user = Req.user)
    Dict = {}
    t = loader.get_template("ajax_simple_msg.html")   
    Dict = {}
    Dict["title"] = "Private API Key"
    Dict["simple_msg"] = Res.private_key
    return http_tmpl_context(Req, t, Dict)    
Exemple #12
0
def user_private_key(Req):
    Res = ApiKeys.objects.get(user=Req.user)
    Dict = {}
    t = loader.get_template("ajax_simple_msg.html")
    Dict = {}
    Dict["title"] = "Private API Key"
    Dict["simple_msg"] = Res.private_key
    return http_tmpl_context(Req, t, Dict)
Exemple #13
0
def news_one(Req, Name):
    Dict = {}
    Res = NewsPage.objects.get(eng_title=Name)
    Dict["page"] = Res
    Dict["keywords"] = Res.meta_keyword
    Dict["description"] = Res.meta_description
    t = loader.get_template("page.html")
    return http_tmpl_context(Req, t, Dict)
Exemple #14
0
def news_one(Req, Name):
    Dict = {}
    Res = NewsPage.objects.get(eng_title=Name)
    Dict["page"] = Res
    Dict["keywords"] = Res.meta_keyword
    Dict["description"] = Res.meta_description
    t = loader.get_template("page.html")
    return http_tmpl_context(Req, t, Dict)
Exemple #15
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) 
def forgot(Req):
    t = loader.get_template("simple_form_center.html")
    Dict = {}
    Dict["title"] = settings.secondary_main_forgot
    forgotForm = UsersForgotMail()
    Dict["form"] = forgotForm.as_p()
    Dict["common_help_text"] = settings.common_help_text
    Dict["action"] = "/forgot_action"
    Dict["action_title"] = settings.reset_password_title
    return http_tmpl_context(Req, t, Dict)
def forgot(Req):
    t = loader.get_template("simple_form_center.html")
    Dict = {}
    Dict["title"] = settings.secondary_main_forgot
    forgotForm = UsersForgotMail()
    Dict["form"] = forgotForm.as_p()
    Dict["common_help_text"] = settings.common_help_text
    Dict["action"] = "/forgot_action"
    Dict["action_title"] = settings.reset_password_title
    return http_tmpl_context(Req, t, Dict)
Exemple #18
0
def my_custom_error_view(request):
    t = loader.get_template('simple_msg.html')
    return http_tmpl_context(
        request, t, {
            "title":
            _("500,хм..."),
            "msg":
            _(u"Произошла какая-то странная ошибка,\
                                                    и мы о ней уже знаем, и побежали исправлять"
              )
        })
Exemple #19
0
def pin_change(Req):
        if not Req.user.is_authenticated():
          return denied(Req)
  
        t = loader.get_template("simple_form.html")   
        Form = PinChangeForm(user = Req.user)  
        Dict = {}
        Dict["form"] = Form.as_p()
        Dict["action"] = "/profile/pin_change_do"
        Dict["action_title"] = settings.pin_change_title
        Dict["pin_load"] = True
        return http_tmpl_context(Req, t, Dict)
Exemple #20
0
def page_private_key(Req):
    Use = False
    if Req.session.has_key("use_f2a"):
        Use = Req.session["use_f2a"]

    t = loader.get_template("common_secure_page_api.html")
    Dict = {}
    Dict["type"] = "show_privat_key"
    Dict["key"] = generate_key()
    Dict["pin_load"] = not Use
    Dict["use_f2a"] = Use
    return http_tmpl_context(Req, t, Dict)
Exemple #21
0
def page_private_key(Req):
     Use = False
     if Req.session.has_key("use_f2a") :
        Use = Req.session["use_f2a"]
     
     t = loader.get_template("common_secure_page_api.html")        
     Dict = {}
     Dict["type"] = "show_privat_key"
     Dict["key"] = generate_key()
     Dict["pin_load"] = not Use
     Dict["use_f2a"] =  Use
     return http_tmpl_context(Req, t, Dict ) 
Exemple #22
0
def pin_change(Req):
    if not Req.user.is_authenticated():
        return denied(Req)

    t = loader.get_template("pin_form_working.html")
    Form = PinChangeForm(user=Req.user)
    Dict = {}
    Dict["title"] = crypton.my_messages.pin_reset_form_title
    Dict["form"] = Form.as_p()
    Dict["action"] = "/profile/pin_change_do"
    Dict["action_title"] = settings.pin_change_title
    Dict["pin_load"] = True
    return http_tmpl_context(Req, t, Dict)
Exemple #23
0
def registration_ref(Req, Reference=None):
    if Req.user.is_authenticated():
        return redirect("/stock")

    Req.session['reference'] = Reference

    t = loader.get_template("registration.html")
    Dict = {}
    Dict["title"] = settings.secondary_main

    regisForm = UsersRegis(initial={"reference": Reference})
    Dict["regis_form"] = regisForm.as_p()
    return http_tmpl_context(Req, t, Dict)
Exemple #24
0
def registration_ref(Req, Reference=None):
    if Req.user.is_authenticated():
        return redirect("/stock")

    Req.session['reference'] = Reference

    t = loader.get_template("registration.html")
    Dict = {}
    Dict["title"] = settings.secondary_main

    regisForm = UsersRegis(initial={"reference": Reference})
    Dict["regis_form"] = regisForm.as_p()
    return http_tmpl_context(Req, t, Dict)
Exemple #25
0
def refs(request):
    
    (TransList,TransTitle) = (None, None)
   
    TransList = user_ref_list(request.user.id)
    TransTitle = ( {"value":_(u"Пользователь")},{"value":_(u"URL from")}, {"value":_(u"Дата регистрации")}, )
   
    
    Dict = {
             "TransList":   TransList,
             "TransTitle":  TransTitle,
            }
    tmpl = loader.get_template("finance_partners_list.html") 
    return http_tmpl_context(request, tmpl, Dict)     
Exemple #26
0
def try_regis(Req):
    Form = UsersRegis(Req.POST)

    if Form.is_valid():
        # Save a new Article object from the form's data.
        regis_new_user(Req, Form)
        return redirect("/regis_success")

    else:
        t = loader.get_template("registration.html")
        Dict = {}
        Dict["title"] = settings.secondary_regis
        Dict["regis_form"] = Form.as_p()
        return http_tmpl_context(Req, t, Dict)
def reset_pwd(request, Key):
    Form = UsersForgotLinkPswd()
    try:
        link = ResetPwdLink.objects.get(key=Key, status="created")
        Dict = {}
        Dict["title"] = my_messages.secondary_main_forgot_link
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = my_messages.forgot_main_help_text
        Dict["action"] = "/reset_pwd_action/" + Key
        Dict["action_title"] = my_messages.forgot_main_update
        t = loader.get_template("simple_form_center.html")
        return http_tmpl_context(request, t, Dict)
    except ResetPwdLink.DoesNotExist:
        return redirect("/reset_link_no_found")
Exemple #28
0
def notification(Req):
         if not Req.user.is_authenticated():
             return denied(Req)  
         else:
             t = loader.get_template("notify.html")   
             Dict = {}
             caching().delete("balance_" + str(Req.user.id) )
             List = list(main.models.Msg.objects.filter(user_to = Req.user,user_from_id = 1, user_hide_to = "false" ))
             page = Req.GET.get('page', 1)
             PageObject = my_cached_paging("notify_" + str(Req.user.id), main.models.Msg, page, List)
             Dict["msgs"] = PageObject.object_list
             Dict["paging"] = PageObject       
             main.models.Msg.objects.filter(user_to = Req.user,user_from_id = 1, user_hide_to = "false" ).update(user_seen_to  = "true")
             return http_tmpl_context(Req, t, Dict ) 
def reset_pwd(request, Key):
    Form = UsersForgotLinkPswd()
    try:
        link = ResetPwdLink.objects.get(key=Key, status="created")
        Dict = {}
        Dict["title"] = my_messages.secondary_main_forgot_link
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = my_messages.forgot_main_help_text
        Dict["action"] = "/reset_pwd_action/" + Key
        Dict["action_title"] = my_messages.forgot_main_update
        t = loader.get_template("simple_form_center.html")
        return http_tmpl_context(request, t, Dict)
    except ResetPwdLink.DoesNotExist:
        return redirect("/reset_link_no_found")
Exemple #30
0
def fin_regis(Req, key):
    try :
        f = ActiveLink.objects.get(key = key,status="created")    
        f.user.is_active = True
        f.user.save()
        f.status = "processed"
        f.save()
        new_api_key(f.user)
        
        t = loader.get_template("finished_success_registration.html")   
        new_pin = PinsImages(user = f.user)
        f.user.backend = 'django.contrib.auth.backends.ModelBackend'
        login(Req, f.user)        
        ShowKey =  new_pin4user(new_pin, f.user)
        Dict = {}
        Dict["title"] = settings.secondary_regis_finish_success
        Dict["pin"] = ShowKey
        return http_tmpl_context(Req, t, Dict) 
    except: 
        t = loader.get_template("finished_error_registration.html")   
        Dict = {}
        Dict["title"] = settings.secondary_regis_finish_error
        return http_tmpl_context(Req, t, Dict)     
Exemple #31
0
def try_regis(Req):
    Form = UsersRegis(Req.POST)

    if Form.is_valid():
        # Save a new Article object from the form's data.
        regis_new_user(Req, Form)
        return redirect("/regis_success")

    else:
        t = loader.get_template("registration.html")
        Dict = {}
        Dict["title"] = settings.secondary_regis
        Dict["regis_form"] = Form.as_p()
        return http_tmpl_context(Req, t, Dict)
Exemple #32
0
def notification(Req):
    if not Req.user.is_authenticated():
        return denied(Req)
    else:
        t = loader.get_template("notify.html")
        Dict = {}
        tornadocache_delete("balance_" + str(Req.user.id))
        List = list(main.models.Msg.objects.filter(user_to=Req.user, user_from_id=1, user_hide_to="false"))
        page = Req.GET.get('page', 1)
        PageObject = my_cached_paging("notify_" + str(Req.user.id), main.models.Msg, page, List)
        Dict["msgs"] = PageObject.object_list
        Dict["paging"] = PageObject
        main.models.Msg.objects.filter(user_to=Req.user, user_from_id=1, user_hide_to="false").update(
            user_seen_to="true")
        return http_tmpl_context(Req, t, Dict)
Exemple #33
0
def depmotion(request, CurrencyTitle):
    CurrencyList = Currency.objects.all()
    cur = Currency.objects.get(title=CurrencyTitle)
    (TransList, TransTitle) = (None, None)
    user_id =  request.user.id
    if SDKCryptoCurrency.has_key(CurrencyTitle):
        ##TODO avoid this
        TransList = list(crypton_currency_list(user_id, CurrencyTitle))
        TransTitle = (
        {"value": _(u"Дебит/Кредит")}, {"value": _(u"Адрес")}, {"value": _(u"Сумма")}, {"value": _(u"Дата")},
        {"value": _(u"Статус")}, {"value": _(u"Подтверждения")}, {"value": _(u"Txid")}  )
    elif CurrencyTitle == "UAH":
        TransList = list(crypton_uah_list(user_id))
        TransTitle = ({"value": _(u"Дебит/Кредит")}, {"value": _(u"Счет")}, {"value": _(u"Сумма")},
                      {"value": _(u"Дата")}, {"value": _(u"Статус")}  )
    else:
        TransList = list(crypton_emoney_list(user_id, cur))
        TransTitle = ({"value": _(u"Дебит/Кредит")}, {"value": _(u"Сумма")},
                      {"value": _(u"Дата")}, {"value": _(u"Статус")}  )

    TransListPage = None
    paginator = Paginator(TransList, 200)  # Show 25 contacts per page

    page = request.GET.get('page', 1)

    try:
        TransListPage = paginator.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        TransListPage = paginator.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        TransListPage = paginator.page(paginator.num_pages)
    # balance =  Balances.objects.get(account = "whole", currency = CurrencyInstance)




    Dict = {
        "paging": True,
        "current_trade": CurrencyTitle,
        "Trans": TransListPage,
        "TransList": TransListPage.object_list,
        "TransTitle": TransTitle,
        "CurrencyList": CurrencyList
    }
    tmpl = loader.get_template("finance_depmotion_home.html")
    return http_tmpl_context(request, tmpl, Dict)
Exemple #34
0
def refs(request):
    (TransList, TransTitle) = (None, None)

    TransList = user_ref_list(request.user.id)
    TransTitle = ( {"value": _(u"Пользователь")},
                   {"value": _(u"Дата регистрации")},
                   {"value": _(u"Доход от даты")},
                   {"value": _(u"Доход")},
                   {"value": _(u"URL from")}
    )

    Dict = {
        "TransList": TransList,
        "TransTitle": TransTitle,
    }
    tmpl = loader.get_template("finance_partners_list.html")
    return http_tmpl_context(request, tmpl, Dict)
Exemple #35
0
def msgs_in(Req):
          if not Req.user.is_authenticated():
             return denied(Req)  
          else:
             t = loader.get_template("msgs.html")   
             Dict = {}
             List = list(main.models.Msg.objects.filter(user_to = Req.user, user_hide_to = "false" ).exclude(user_from_id = 1))
             Dict["msg_in_count"] = len(List)
             Dict["msg_out_count"] = main.models.Msg.objects.filter(user_from = Req.user, user_hide_from = "false" ).exclude(user_to_id = 1).count()

             Dict["is_msg_in"] = True
             page = Req.GET.get('page', 1)
             PageObject = my_cached_paging("msgs_in_" + str(Req.user.id), main.models.Msg, page,  List)
             Dict["msgs"] = PageObject.object_list
             Dict["paging"] = PageObject          
             
             main.models.Msg.objects.filter(user_to = Req.user, user_hide_to = "false" ).update(user_seen_to  = "true")
             return http_tmpl_context(Req, t, Dict ) 
Exemple #36
0
def fin_regis(Req, key):
    #try :
    f = ActiveLink.objects.get(key=key, status="created")
    f.user.is_active = True
    f.user.save()
    f.status = "processed"
    f.save()
    new_api_key(f.user)

    t = loader.get_template("finished_success_registration.html")
    new_pin = PinsImages(user=f.user)
    f.user.backend = 'django.contrib.auth.backends.ModelBackend'
    login(Req, f.user)
    ShowKey = new_pin4user(new_pin, f.user)
    Dict = {}
    Dict["title"] = settings.secondary_regis_finish_success
    Dict["pin"] = ShowKey
    return http_tmpl_context(Req, t, Dict)
Exemple #37
0
def msgs_in(Req):
    if not Req.user.is_authenticated():
        return denied(Req)
    else:
        t = loader.get_template("msgs.html")
        Dict = {}
        List = list(main.models.Msg.objects.filter(user_to=Req.user, user_hide_to="false").exclude(user_from_id=1))
        Dict["msg_in_count"] = len(List)
        Dict["msg_out_count"] = main.models.Msg.objects.filter(user_from=Req.user, user_hide_from="false").exclude(
            user_to_id=1).count()

        Dict["is_msg_in"] = True
        page = Req.GET.get('page', 1)
        PageObject = my_cached_paging("msgs_in_" + str(Req.user.id), main.models.Msg, page, List)
        Dict["msgs"] = PageObject.object_list
        Dict["paging"] = PageObject

        main.models.Msg.objects.filter(user_to=Req.user, user_hide_to="false").update(user_seen_to="true")
        return http_tmpl_context(Req, t, Dict)
Exemple #38
0
def stock(Req, Title="btc_uah"):
    if Title is None:
        Title = Req.session.get('stock_path', None)
        if Title is None:
            Title = "btc_uah"
            Req.session['stock_path'] = Title

    t = loader.get_template("index.html")

    Dict = setup_trades_pairs(Title)
    # Dict = setup_common_orders(Req, Title, Dict )
    Dict["current_stock"] = Title
    Dict["title"] = settings.secondary_main
    Dict["trade_pair"] = Title
    Dict["help"] = True
    Dict["usd_uah_rate"] = get_memory_var("usd_uah_rate")
    Req.session['stock_path'] = Title

    return http_tmpl_context(Req, t, Dict)
Exemple #39
0
def stock(Req, Title="btc_uah"):
    if Title is None:
        Title = Req.session.get('stock_path', None)
        if Title is None:
            Title = "btc_uah"
            Req.session['stock_path'] = Title

    t = loader.get_template("index.html")

    Dict = setup_trades_pairs(Title)
    # Dict = setup_common_orders(Req, Title, Dict )
    Dict["current_stock"] = Title
    Dict["title"] = settings.secondary_main
    Dict["trade_pair"] = Title
    Dict["help"] = True
    Dict["usd_uah_rate"] = get_memory_var("usd_uah_rate")
    Req.session['stock_path'] = Title

    return http_tmpl_context(Req, t, Dict)
def reset_pwd_action(request, Key):
    link = None
    try:
        link = ResetPwdLink.objects.get(key=Key, status="created")
    except:
        return redirect("/reset_link_no_found")
    Form = UsersForgotLinkPswd(request.POST)
    Dict = {}
    if Form.is_valid():
        link.status = "processed"
        passwd = Form.cleaned_data["password1"]
        link.user.set_password(passwd)
        link.user.save()
        link.save()
        return redirect("/reset_success")
    else:
        t = loader.get_template("simple_form_center.html")
        Dict["title"] = my_messages.secondary_main_forgot_link
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = my_messages.forgot_main_help_text
        Dict["action"] = "/reset_pwd_action/" + Key
        Dict["action_title"] = my_messages.forgot_main_update
        return http_tmpl_context(request, t, Dict)
def reset_pwd_action(request, Key):
    link = None
    try:
        link = ResetPwdLink.objects.get(key=Key, status="created")
    except:
        return redirect("/reset_link_no_found")
    Form = UsersForgotLinkPswd(request.POST)
    Dict = {}
    if Form.is_valid():
        link.status = 'processed'
        passwd = Form.cleaned_data["password1"]
        link.user.set_password(passwd)
        link.user.save()
        link.save()
        return redirect("/reset_success")
    else:
        t = loader.get_template("simple_form_center.html")
        Dict["title"] = my_messages.secondary_main_forgot_link
        Dict["form"] = Form.as_p()
        Dict["common_help_text"] = my_messages.forgot_main_help_text
        Dict["action"] = "/reset_pwd_action/" + Key
        Dict["action_title"] = my_messages.forgot_main_update
        return http_tmpl_context(request, t, Dict)
Exemple #42
0
def news_cat(Req, i):
    t = loader.get_template("news_page.html")
    return http_tmpl_context(Req, t, {"category": i})
Exemple #43
0
def news(Req):
    t = loader.get_template("news_page.html")
    return http_tmpl_context(Req, t, {})
Exemple #44
0
def login_page(request):
    if request.user.is_authenticated():
        return redirect("/stock")
    t = loader.get_template("login_page.html")
    Dict = {}
    return http_tmpl_context(request, t, Dict)
Exemple #45
0
def login_page(request):
    if request.user.is_authenticated():
        return redirect("/finance")
    t = loader.get_template("login_page.html")
    Dict = {}
    return http_tmpl_context(request, t, Dict)
Exemple #46
0
def pin_image_page(request, Key):
        Dict = {}
        t = loader.get_template("pin_page.html")
        Dict["title"] = settings.pin_page
        Dict["pin"] = Key
        return http_tmpl_context(request, t, Dict)
Exemple #47
0
def crypto_balances_home(request):
    t = loader.get_template("crypto_open_balances.html")
    Dict = {}
    Dict["pagetitle"] = _(u"Публичная информация о балансах криптовалют")
    Dict["CurrencyList"] = Currency.objects.exclude(id=1)
    return http_tmpl_context(request, t, Dict)
Exemple #48
0
def news(Req):
    t = loader.get_template("news_page.html")
    return http_tmpl_context(Req, t, {})
Exemple #49
0
def news_cat(Req, i):
    t = loader.get_template("news_page.html")
    return http_tmpl_context(Req, t, {"category": i})
Exemple #50
0
def page_help(Req):
    Dict = {}
    t = loader.get_template("page_help.html")
    Dict["title"] = settings.help_page
    return http_tmpl_context(Req, t, Dict)
Exemple #51
0
def page_discuss(Req, Id):
    Dict = {}
    Res = StaticPage.objects.get(id=int(Id))
    Dict["page"] = Res
    t = loader.get_template("page_discuss.html")
    return http_tmpl_context(Req, t, Dict)
Exemple #52
0
def my_custom_error_view(request):
    t = loader.get_template('simple_msg.html')
    return http_tmpl_context(request, t, {"title": _("500,хм..."),
                                          "msg": _(u"Произошла какая-то странная ошибка,\
                                                    и мы о ней уже знаем, и побежали исправлять")})
Exemple #53
0
def page_help(Req):
    Dict = {}
    t = loader.get_template("page_help.html")
    Dict["title"] = settings.help_page
    return http_tmpl_context(Req, t, Dict)
Exemple #54
0
def index(Req):
    t = loader.get_template("home.html")
    Dict = {}
    Dict["pagetitle"] = settings.pagetitle_main
    Dict["title"] = settings.pagetitle_home
    return http_tmpl_context(Req, t, Dict)
Exemple #55
0
def page_discuss(Req, Id):
    Dict = {}
    Res = StaticPage.objects.get(id=int(Id))
    Dict["page"] = Res
    t = loader.get_template("page_discuss.html")
    return http_tmpl_context(Req, t, Dict)
Exemple #56
0
def crypto_balances_home(request):
    t = loader.get_template("crypto_open_balances.html")
    Dict = {}
    Dict["pagetitle"] = _(u"Публичная информация о балансах криптовалют")
    Dict["CurrencyList"] = Currency.objects.exclude(id=1)
    return http_tmpl_context(request, t, Dict)
def forgot_success(Req):
    t = loader.get_template("simple_msg_center.html")
    Dict = {}
    Dict["title"] = my_messages.secondary_main_forgot
    Dict["simple_msg"] = my_messages.forgot_sending_email_msg
    return http_tmpl_context(Req, t, Dict)
Exemple #58
0
def index(Req):
    t = loader.get_template("index.html")
    Dict = {}
    Dict["pagetitle"] = settings.pagetitle_main
    Dict["title"] = settings.pagetitle_home
    return http_tmpl_context(Req, t, Dict)
Exemple #59
0
def regis_success(Req):
    t = loader.get_template("success_registration.html")
    Dict = {}
    Dict["title"] = settings.secondary_regis_success
    return http_tmpl_context(Req, t, Dict)
Exemple #60
0
def regis_success(Req):
    t = loader.get_template("success_registration.html")
    Dict = {}
    Dict["title"] = settings.secondary_regis_success
    return http_tmpl_context(Req, t, Dict)