Browse Source

Fixed search field length in search view

Jeremy Stretch 7 years ago
parent
commit
45d6955260
2 changed files with 2 additions and 2 deletions
  1. 1 1
      netbox/netbox/forms.py
  2. 1 1
      netbox/templates/search_form.html

+ 1 - 1
netbox/netbox/forms.py

@@ -38,7 +38,7 @@ OBJ_TYPE_CHOICES = (
 
 
 class SearchForm(BootstrapMixin, forms.Form):
 class SearchForm(BootstrapMixin, forms.Form):
     q = forms.CharField(
     q = forms.CharField(
-        label='Search', widget=forms.TextInput(attrs={'style': 'width: 350px'})
+        label='Search'
     )
     )
     obj_type = forms.ChoiceField(
     obj_type = forms.ChoiceField(
         choices=OBJ_TYPE_CHOICES, required=False, label='Type'
         choices=OBJ_TYPE_CHOICES, required=False, label='Type'

+ 1 - 1
netbox/templates/search_form.html

@@ -1,7 +1,7 @@
 <div class="row" style="padding-bottom: 20px">
 <div class="row" style="padding-bottom: 20px">
     <div class="col-md-12 text-center">
     <div class="col-md-12 text-center">
         <form action="{% url 'search' %}" method="get" class="form-inline">
         <form action="{% url 'search' %}" method="get" class="form-inline">
-            {{ search_form.q }}
+            <input type="text" name="q" value="{{ request.GET.q }}" placeholder="Search" id="id_q" class="form-control" style="width: 350px" />
             {{ search_form.obj_type }}
             {{ search_form.obj_type }}
             <button type="submit" class="btn btn-primary">Search</button>
             <button type="submit" class="btn btn-primary">Search</button>
         </form>
         </form>