Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def bankcreate( requset , info_id = 0 ):
- print(' -----> id is ' + str(info_id))
- errors = []
- default = None
- if info_id is not None and info_id > 0 :
- try:
- default = BankAccounts.objects.get(id=info_id , user_id=requset.user.id)
- except BankAccounts.DoesNotExist :
- default = None
- if requset.POST :
- VALIDATIONRULES = {} # some rules here
- data , errors = validation(requset , VALIDATIONRULES)
- if not errors :
- if info_id > 0 and default is not None:
- ba = default
- else :
- ba = BankAccounts()
- ba.bank_accnumber = data['bank_accnumber']
- ba.bank_cartnumber = data['bank_cartnumber']
- ba.bank_shabanumber = data['bank_shabanumber']
- ba.bank_title = data['bank_title']
- ba.user_id = requset.user.id
- ba.save()
- return redirect('account-bank')
- else:
- default = data
- return render(requset , 'account/bankcreate-form.html' ,
- {'default':default , 'errors':errors} )
- urlpatterns = [
- url(r'^$', views.index , name='account-home'),
- url(r'^edit$', views.edit , name='account-edit'),
- url(r'^bankinfo', views.bankinfo , name='account-bank'),
- url(r'^bankcreate/(?:/(?P<info_id>[1-9]+)/)?', views.bankcreate , name='account-bankcreate'),
- ]
- url(r'^bankcreate/(?:/(?P<info_id>[1-9]+)/)?', views.bankcreate , name='account-bankcreate'),
- http://localhost:8000/account/bankcreate/1/
- url(r'^bankcreate/(?:/(?P<info_id>[1-9]+)/)?/$'
- url(r'^bankcreate/(?:/(?P<info_id>[1-9]+)/)?$'
- Page not found (404)
- Request Method: GET
- Request URL: http://localhost:8000/account/bankcreate/1/
- Using the URLconf defined in paypal.urls, Django tried these URL patterns, in this order:
- ^$
- ^admin/
- ^account/ ^$ [name='account-home']
- ^account/ ^edit$ [name='account-edit']
- ^account/ ^email [name='account-email']
- ^account/ ^bankinfo [name='account-bank']
- ^account/ ^bankcreate/(?:/(?P<info_id>[1-9]+)/)?$ [name='account-bankcreate']
- ^account/ ^password [name='account-password']
- ^gateway/
- ^auth/
- The current URL, account/bankcreate/1/, didn't match any of these.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement