mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 10:59:00 +00:00
Improvement in Bank Attribute Endpoint
This commit is contained in:
parent
6601a3c934
commit
14f25e3318
@ -10,6 +10,13 @@ import random
|
||||
|
||||
class CreateBankForm(forms.Form):
|
||||
|
||||
ATTRIBUTE_TYPE = (
|
||||
('', _('Any')),
|
||||
('STRING', 'STRING'),
|
||||
('INTEGER', 'INTEGER'),
|
||||
('DOUBLE', 'DOUBLE'),
|
||||
('DATE_WITH_DAY', 'DATE_WITH_DAY'),
|
||||
)
|
||||
bank_id = forms.CharField(
|
||||
label=_('Bank Id'),
|
||||
widget=forms.TextInput(
|
||||
@ -87,36 +94,16 @@ class CreateBankForm(forms.Form):
|
||||
required=False,
|
||||
)
|
||||
|
||||
type_attribute = forms.CharField(
|
||||
type_attribute = forms.ChoiceField(
|
||||
label=_('Type'),
|
||||
widget=forms.TextInput(
|
||||
choices=ATTRIBUTE_TYPE,
|
||||
widget=forms.Select(
|
||||
attrs={
|
||||
'placeholder': _('Type'),
|
||||
'class': 'form-control',
|
||||
'class': 'form-control bank_attribute_type',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
name_attribute = forms.CharField(
|
||||
label=_('Attribute Name'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': _('Name'),
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
value_attribute = forms.CharField(
|
||||
label=_('Value'),
|
||||
widget=forms.TextInput(
|
||||
attrs={
|
||||
'placeholder': _('2012-04-23'),
|
||||
'class': 'form-control',
|
||||
}
|
||||
),
|
||||
required=False,
|
||||
)
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs.setdefault('label_suffix', '')
|
||||
|
||||
@ -80,30 +80,30 @@
|
||||
<div class="row">
|
||||
<h1>Bank Attributes</h1>
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<label class="form-group">{% trans "Attribute Name" %}:</label> <br>
|
||||
<label class="form-group">{% trans "Attribute Name" %}</label>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<label class="form-group">{% trans "Attribute Type" %}:</label> <br>
|
||||
<label class="form-group">{% trans "Attribute Type" %}</label>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<label class="form-group">{% trans "Attribute Value" %}:</label> <br>
|
||||
<label class="form-group">{% trans "Attribute Value" %}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="runner">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<div class="form-group" cols="1" rows="1">
|
||||
<input class="bank_attribute_name" value="Attribute Name">
|
||||
<input class="bank_attribute_name form-control" placeholder="ATTRIBUTE_1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-3">
|
||||
<div class="form-group" cols="1" rows="1">
|
||||
<input class="bank_attribute_type" value="Attribute Type">
|
||||
{{ form.type_attribute }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-sm-3">
|
||||
<div class="form-group" cols="1" rows="1">
|
||||
<input class="bank_attribute_value" value="Attribute Value">
|
||||
<input class="bank_attribute_value form-control" placeholder="abc">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-sm-3">
|
||||
@ -169,7 +169,6 @@ $(document).ready(function($) {
|
||||
$('.runner button.forUpdate').attr("disabled", "disabled");
|
||||
$('.runner button.forSave').attr("disabled", "disabled");
|
||||
$('.runner button.forDelete').attr("disabled", "disabled");
|
||||
|
||||
$.post('save/attribute', {
|
||||
'name': name,
|
||||
'type': type,
|
||||
|
||||
@ -174,7 +174,6 @@ class UpdateBanksView(LoginRequiredMixin, FormView):
|
||||
@csrf_exempt
|
||||
def bank_attribute_save(request):
|
||||
api = API(request.session.get('obp'))
|
||||
#urlpath = '/my/api-collections'
|
||||
bank_id = request.POST.get('bank_id').strip()
|
||||
urlpath_save = '/banks/{}/attribute'.format(bank_id)
|
||||
|
||||
@ -185,7 +184,6 @@ def bank_attribute_save(request):
|
||||
'is_active': True
|
||||
}
|
||||
result = api.post(urlpath_save, payload = payload, version=settings.API_ROOT['v510'])
|
||||
print("result", result)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user