Skip to content

Commit

Permalink
Merge pull request #127 from globocom/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Malinoski authored Aug 10, 2021
2 parents cb9dfbc + 0c1151e commit eb9346c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CadVlan/EquipScript/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AssociateScriptForm(EquipForm):
def __init__(self, script_list, *args, **kwargs):
super(AssociateScriptForm, self).__init__(*args, **kwargs)
self.fields['script'].choices = [
(st['id'], st['roteiro'] + " - " + st['descricao']) for st in script_list["script"]]
(st['id'], st['roteiro'] + " - " + st['descricao'] + " - " + st['id']) for st in script_list["script"]]

script = forms.ChoiceField(label='', required=True, widget=forms.Select(
attrs={'style': "width: 400px"}), error_messages=error_messages)
3 changes: 2 additions & 1 deletion CadVlan/EquipScript/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ def search_list(request):
# Get user
auth = AuthSession(request.session)
client = auth.get_clientFactory()

# Get all script_types from NetworkAPI
script_list = client.create_roteiro().listar()
script_list['script'] = sorted(script_list['script'], key=lambda k: k['roteiro'].lower())

lists['add_form'] = AssociateScriptForm(script_list)

Expand Down
3 changes: 2 additions & 1 deletion CadVlan/templates/ajax/equip-script-form.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
limitations under the License.
-->
<p>Selecione o roteiro que deseja associar:</p>
<small><b><i>(Roteiro - Descrição - ID)</i></b></small>
<form id="add_form" method="post" action="{% url equip.script.add.ajax %}">
{% csrf_token %}
{% for field in add_form %}
{{ field }}
{{ field }}
<p id="error">
{% for error in field.errors %}
{{ error|escape }}
Expand Down

0 comments on commit eb9346c

Please # to comment.