Add ability to search for UUIDs
diff --git a/crashreport_stats/static/crashreport_stats/style.css b/crashreport_stats/static/crashreport_stats/style.css
index b7f51f6..940ddc9 100644
--- a/crashreport_stats/static/crashreport_stats/style.css
+++ b/crashreport_stats/static/crashreport_stats/style.css
@@ -38,3 +38,7 @@
 div#logfile-modal-body {
   margin: 25px;
 }
+
+td#uuid {
+font-family: monospace;
+}
diff --git a/crashreport_stats/templates/crashreport_stats/home.html b/crashreport_stats/templates/crashreport_stats/home.html
index fbedb20..9fa8964 100644
--- a/crashreport_stats/templates/crashreport_stats/home.html
+++ b/crashreport_stats/templates/crashreport_stats/home.html
@@ -1,27 +1,71 @@
 {% extends "base.html" %}
-    {% block content %}
-    {% load crashreport_stats_tags %}
-    {% load bootstrap %}
-    {% load crispy_forms_tags %}
+{% block content %}
+{% load crashreport_stats_tags %}
+{% load bootstrap %}
+{% load crispy_forms_tags %}
 
-    <div class="row">
-      <div class="col-md-12">
-        <div class="panel">
-          <div> 
+  <div class="row">
+    <div class="col-md-12">
+
+      <div class="panel">
+          <div>
             <h4>Search for device:</h4>
-            {% if messages %}
-            <ul class="messages">
-              {% for message in messages %}
-              <li class="{{ message.tags }}">{{ message }}</li>
-              {% endfor %}
-            </ul>
-            {% endif %}
-          <form action="" method="post">
-            {% csrf_token %}
-              {{ form|bootstrap  }}
-                <input type="submit" value="Search" />
-          </form>
+            <form action="" method="post">
+              {% csrf_token %}
+                {{ form|bootstrap  }}
+                  <input type="submit" value="Search" />
+            </form>
         </div>
       </div>
+
+      {% if devices %}
+      <div class="panel">
+        <div>
+          <h4> Search Results </h4>
+          <table id='devices' class="display" width="100%" cellspacing="0">
+            <thead>
+              <tr>
+                <th>UUID</th>
+                <th>Board date</th>
+                <th>Chipset</th>  
+              </tr>
+            </thead>
+            {% for device in devices %}
+            <tr>
+              <td class='uuid'>
+                <a href="{% url 'hiccup_stats_device'%}?uuid={{device.uuid}}">{{device.uuid}}</a>
+              </td>
+              <td>
+                {{device.board_date}}
+              </td>
+              <td>
+                {{device.chipset}}
+              </td>
+            </tr>
+            {% endfor %}
+          </table>
+        </div>
+      </div>
+      {% endif %}
+
+      {% if messages %}
+      <div class="panel">
+        <div>
+          <h4> Status Messages </h4>
+          <ul class="messages">
+            {% for message in messages %}
+            <li class="{{ message.tags }}">{{ message }}</li>
+            {% endfor %}
+          </ul>
+        </div>
+      </div>
+      {% endif %}
+
     </div>
+  </div>
+  <script>
+$(document).ready(function() {
+    $('#devices').DataTable();
+} );
+</script>
  {% endblock content %}
diff --git a/crashreport_stats/views.py b/crashreport_stats/views.py
index 49313eb..9ec7dc6 100644
--- a/crashreport_stats/views.py
+++ b/crashreport_stats/views.py
@@ -5,7 +5,7 @@
 from django.template import loader
 from itertools import chain
 from django.db import connection
-from  crashreport_stats import raw_querys
+from crashreport_stats import raw_querys
 from django.contrib.auth.decorators import user_passes_test
 from django import forms
 from django.contrib import messages
@@ -38,16 +38,26 @@
 
 @user_passes_test(is_fairphone_staff)
 def home(request):
+    """ The home view allows to search for devices. """
+    devices = None
     if request.method == 'POST':
         # create a form instance and populate it with data from the request:
         form = DeviceUUIDForm(request.POST)
         if form.is_valid():
             uuid = form.cleaned_data['uuid']
             if not Device.objects.filter(uuid=uuid).exists():
-                messages.warning(request, "Device does not exist")
+                devices = Device.objects.filter(uuid__startswith=uuid)
+                if len(devices)==1:
+                    return HttpResponseRedirect(
+                        reverse("hiccup_stats_device")+'?uuid='+devices[0].uuid)
+                elif len(devices)==0:
+                     messages.warning(request, "No devices found.")
             else:
-                return HttpResponseRedirect(reverse("hiccup_stats_device")+'?uuid='+uuid)
+                return HttpResponseRedirect(
+                    reverse("hiccup_stats_device")+'?uuid='+uuid)
     else:
         form = DeviceUUIDForm()
     template = loader.get_template('crashreport_stats/home.html')
-    return HttpResponse(template.render({'form':form}, request))
+    return HttpResponse(template.render(
+        {'form':form, 'devices':devices}
+        , request))