Esempio n. 1
0
def pay_rent_detail(request, rent_uuid):
    try:
        renter = models.LandlordRenterInfo.objects.get(uuid=rent_uuid)
        return utils.render('pay/detail_landlord.html', {'renter': renter})
    except models.LandlordRenterInfo.DoesNotExist:
        # Else use an renter detail template
        renter = get_object_or_404(models.RenterRentProfile, uuid=rent_uuid)
        return utils.render('pay/detail_renter.html', {'renter': renter})
Esempio n. 2
0
 def form_valid(self, form):
     data = form.cleaned_data
     users = models.Merchant.objects.filter(username=data['username'])
     if users and users[0].password == data['password']:
         LOG.debug('%s login success.' % users)
         utils.set_session(self.request, users[0].username)
         return utils.render('merchant/home.html', {'welcome': 'Welcome'})
     else:
         LOG.debug('%s login failed.' % users)
         return utils.render('merchant/m_sign_in.html',
                             {'error': 'Username or password is wrong!',
                              'form':form})
Esempio n. 3
0
 def form_valid(self, form):
     data = form.cleaned_data
     user = models.Merchant(**data)
     user.save()
     content = 'Welcome Merchant! You have successed to sign up!'
     mersendmessage(self.request, content)
     return utils.render('merchant/home.html', {'welcome': 'Welcome'})
Esempio n. 4
0
def safe(req):
    usernam = req.session.get('username')
    user = models.User.objects.filter(username=usernam)
    local_time = time.strftime('%Y-%m-%d-%H:%M:%S',
                               time.localtime(time.time()))
    return utils.render('security_certificate.html',
                        {'local_time': local_time,
                         'phone': user[0].phone})
Esempio n. 5
0
def accountmoney(request):
    merchant = utils.get_merchant_obj(request)
    money = merchant.accountmoney_set.all()
    # totalmoney = models.TotalMoney.objects.filter(owner_id=merchant.id)
    totalmoney = 0.0
    for m in money:
        totalmoney += m.in_out_money
    return utils.render("merchant/accountmoney.html", {"totalmoney": totalmoney, "money": money})
Esempio n. 6
0
 def form_valid(self, form):
     data = form.cleaned_data
     user = models.User(**data)
     user.save()
     content = 'Welcome to zufangbao! You have successed to sign up!'
     sendmessage(self.request, content)
     content = data['username'] + ' registration succeed!'
     utils.send_mail(data['email'], content)
     return utils.render('portal.html', {})
Esempio n. 7
0
def info(req):
    usernam = req.session.get('username')
    user = models.User.objects.filter(username=usernam)
    return utils.render('personal_info.html',
                        {'username': user[0].username,
                         'phone': user[0].phone,
                         'real_id': user[0].real_id,
                         'real_name': user[0].real_name,
                         'email': user[0].email})
Esempio n. 8
0
def account_payrent_list(request):
    user = utils.get_user_obj(request)

    renters = []
    passive_renters = user.landlordrenterinfo_set.all()
    active_renters = user.renterrentprofile_set.all()

    renters.extend(passive_renters)
    renters.extend(active_renters)
    renters.sort(key=lambda x: x.created_at)
    renters.reverse()
    return utils.render('account/payrentlist.html',
                        {'renters': renters})
    user = utils.get_user_obj(request)

    if user.is_vip == False:
        return vipconfirm(request)
    else:
        return utils.render('account/vip.html', {'message': 'Welcome,VIP!'})
Esempio n. 9
0
 def form_valid(self, form):
     merchant = utils.get_merchant_obj(self.request)
     data = form.cleaned_data
     if merchant and merchant.password == data["oldpassword"] and data["newpassword"] == data["newpassagain"]:
         merchant.password = data["newpassword"]
         merchant.save()
         return merchantaccount(self.request)
     else:
         LOG.debug("%s Change password failed." % merchant)
         return utils.render("merchant/changepassword.html", {"errors": "Password is wrong", "form": form})
Esempio n. 10
0
 def form_valid(self, form):
     merchant = utils.get_merchant_obj(self.request)
     # form.instance.owner = merchant
     # form.save()
     # return accountmoney(self.request)
     data = form.cleaned_data
     tn = random.uniform(1, 100)
     if alipay.create_direct_pay_by_user(tn, data["pay_type"], data["operation_name"], data["in_out_money"]):
         form.instance.owner = merchant
         form.save()
     return utils.render("merchant/paysuccess.html", {})
Esempio n. 11
0
 def form_valid(self, form):
     merchant = utils.get_merchant_obj(self.request)
     data = form.cleaned_data
     if merchant and merchant.password == data['oldpassword'] and data['newpassword'] == data['newpassagain']:
         merchant.password = data['newpassword']
         merchant.save()
         return merchantaccount(self.request)
     else:
         LOG.debug("%s Change password failed." %merchant )
         return utils.render('merchant/changepassword.html',
                             {'errors': 'Password is wrong',
                              'form': form})
Esempio n. 12
0
 def form_valid(self, form):
     data = form.cleaned_data
     users = models.User.objects.filter(username=data['username'])
     if users and users[0].password == data['password']:
         LOG.debug('%s login success.' % users)
         utils.set_session(self.request, users[0].username)
         return portal(self.request)
     else:
         LOG.debug("%s login failed." % users)
         return utils.render('sign_in.html',
                             {'errors': 'Username or password is wrong',
                              'form': form})
Esempio n. 13
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and user.password == data['password'] and \
        data['new_password'] == data['confirm_new_password']:
         user.password = data['new_password']
         user.save()
         return info(self.request)
     else:
     #LOG.debug("%s password modify failed." % user)
         return utils.render('password_modify.html',
                             {'errors': 'password is wrong',
                              'form': form})
Esempio n. 14
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user:
         user.real_name = data['real_name']
         user.real_id = data['real_id']
         user.save()
         return info(self.request)
     else:
     #LOG.debug("%s name certificate failed." % user)
         return utils.render('name_certificate.html',
                             {'errors': 'failed',
                              'form': form})
Esempio n. 15
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['verification_code'] == str(user.verifycode):
         user.phone = data['newphone']
         user.is_active = False
         user.save()
         return info(self.request)
     else:
         user.is_active = False
         user.save()
         return utils.render('phone_modify.html',
                            {'errors': 'verifycode is wrong!',
                             'form': form})
Esempio n. 16
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['phone']:
         user.verifycode = random.randrange(0, 999999)
         user.save()
         content = 'verifycode:' + str(user.verifycode)
         utils.send_msg(data['phone'], content)
         return phonemodify(self.request)
     else:
     #LOG.debug("%s phone modify failed." % user)
         return utils.render('send_verifycode.html',
                             {'errors': 'failed',
                              'form': form})
Esempio n. 17
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     print user.verifycode
     if user and data['phone'] and \
        data['verification_code'] == str(user.verifycode):
         user.phone = data['phone']
         user.save()
         return safe(self.request)
     else:
     #LOG.debug("%s phone modify failed." % user)
         return utils.render('phone_modify.html',
                             {'errors': 'phone number is wrong',
                              'form': form})
Esempio n. 18
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['problem_one'] and \
        data['problem_two'] and data['problem_three']:
         user.problem_one = data['problem_one']
         user.problem_two = data['problem_two']
         user.problem_three = data['problem_three']
         user.save()
         return safe(self.request)
     else:
     #LOG.debug("%s failed." % user)
         return utils.render('security_problem.html',
                             {'errors': 'failed',
                              'form': form})
Esempio n. 19
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['email']:
         content = 'click here to active ' + \
                 '<a href="http://www.zufangbao.com/chargerent/">' \
                 'http://www.active.com</a>'
         utils.send_mail(data['email'], content)
         user.email = data['email']
         user.save()
         return safe(self.request)
     else:
     #LOG.debug("%s mailbox modify failed." % user)
         return utils.render('mailbox_modify.html',
                             {'errors': 'failed',
                              'form': form})
Esempio n. 20
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['newphone']:
         if user.is_active == False:
             user.verifycode = random.randrange(0, 999999)
             user.is_active = True               
             user.save()
             print user.verifycode
             content = 'verifycode:' + str(user.verifycode)
             utils.send_msg(data['newphone'], content)
             return phonemodify(self.request)
         else:
             return phonemodify(self.request)
     else:           
         return utils.render('phone_modify.html',
                             {'errors': 'failed',
                              'form': form})
Esempio n. 21
0
 def form_valid(self, form):
     user = utils.get_user_obj(self.request)
     data = form.cleaned_data
     if user and data['email']:
         para = user.username
         content = 'click here to active ' + \
                 '<a href="http://localhost:8000/z/account/activate_mailbox/?username='******'">' + \
                 'http://www.active.com</a>'
         utils.send_mail(data['email'], content)    
         for i in range(120):
             time.sleep(1)
             user = utils.get_user_obj(self.request)
             if user.is_active == True: 
                 user.email = data['email']
                 user.is_active = False
                 user.save()
                 break
         return info(self.request)
     else:
     #LOG.debug("%s mailbox modify failed." % user)
         return utils.render('mailbox_modify.html',
                             {'errors': 'failed',
                              'form': form})
Esempio n. 22
0
def charge_renter_done(request, rent_id, renter_id):
    renter = get_object_or_404(models.LandlordRenterInfo,
                               pk=renter_id, rent_id=rent_id)
    renter.state = '1'
    renter.save()
    return utils.render('charge/renter_finish.html', {})
Esempio n. 23
0
def charge_renter_confirm(request, rent_id, renter_id):
    renter = get_object_or_404(models.LandlordRenterInfo,
                               pk=renter_id, rent_id=rent_id)
    return utils.render('charge/renter_confirm.html',
                        {'renter': renter})
Esempio n. 24
0
def charge_rent_detail(request, profile_id):
    rent = get_object_or_404(models.LandlordRentProfile, pk=profile_id)
    return utils.render('charge/detail.html', {'rent': rent})
Esempio n. 25
0
def merchantconfirm(request):
    merchant = utils.get_merchant_obj(request)
    confirm = models.MerchantConfirm.objects.filter(owner_id=merchant.id)[0]
    return utils.render("merchant/accountconfirm.html", {"confirm": confirm})
Esempio n. 26
0
def merchantaccount(request):
    merchant = utils.get_merchant_obj(request)
    return utils.render(
        "merchant/accountmanage.html",
        {"username": merchant.username, "real_name": merchant.real_name, "phone": merchant.phone},
    )
Esempio n. 27
0
def housemanage(request):
    merchant = utils.get_merchant_obj(request)
    # merchant_id = merchant.id
    # house = models.House.objects.filter(owner_id=merchant_id)
    house = merchant.house_set.all()
    return utils.render("merchant/house.html", {"house": house})
Esempio n. 28
0
def merchanthome(request):
    return utils.render("merchant/home.html", {"welcome": "Welcome"})
Esempio n. 29
0
def merchantmessage(request):
    merchant = utils.get_merchant_obj(request)
    message = merchant.merhantmessage_set.all()
    return utils.render("merchant/merchantmessage.html", {"message": message})
Esempio n. 30
0
def rentalaccount(request):
    merchant = utils.get_merchant_obj(request)
    rentalaccount = merchant.rentalaccount_set.all()
    return utils.render("merchant/rentalaccount.html", {"rentalaccount": rentalaccount})