def get(self, request): if request.user.is_authenticated: cardzip = {} user = UserProfile.objects.get(username=request.user.username) cards = user.user_card.all().order_by('id') for card in cards: if card.is_binded == True: cardzip[card] = '已绑定' else: cardzip[card] = '可绑定' return render(request, 'profilecard.html', { 'cards': cards, 'cardzip': cardzip }) return render(request, 'login.html', {'captcha': captcha()})
def bindCard(request): if request.user.is_authenticated: all_money = request.POST.get('all_money', '') all_id = request.POST.get('all_id', '') user = UserProfile.objects.get(username=request.user.username) cards = user.user_card.all().order_by('id') is_bind = [] not_bind = [] for card in cards: if card.is_binded == True: is_bind.append(card) else: not_bind.append(card) return render( request, 'bindcard.html', { 'is_bind': is_bind, 'not_bind': not_bind, 'cards': cards, 'all_money': all_money, 'all_id': all_id }) return render(request, 'login.html', {'captcha': captcha()})
def get(self, request): if request.user.is_authenticated: return render(request, 'opencard.html', {}) return render(request, 'login.html', {'captcha': captcha()})
def getBank(request): if request.user.is_authenticated: # 如果没有登录用户 则返回到登录界面 return render(request, 'index_b.html', {}) return render(request, 'login.html', {'captcha': captcha()})
def get(self, request): if request.user.is_authenticated: user = UserProfile.objects.get(username=request.user.username) cards = user.user_card.all().order_by('id') return render(request, 'cancel.html', {'cards': cards}) return render(request, 'login.html', {'captcha': captcha()})
def contact(request): if request.user.is_authenticated: return render(request, 'contact.html', {}) return render(request, 'login.html', {'captcha': captcha()})