diff --git a/welco/contacts/views.py b/welco/contacts/views.py
new file mode 100644
index 0000000..529da1b
--- /dev/null
+++ b/welco/contacts/views.py
@@ -0,0 +1,47 @@
+# welco - multichannel request processing
+# Copyright (C) 2015 Entr'ouvert
+#
+# This program is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+
+from django import template
+from django.template import RequestContext
+from django.views.decorators.csrf import csrf_exempt
+from django.views.generic import TemplateView
+
+class HomeZone(object):
+ def __init__(self, request):
+ self.request = request
+
+ def render(self):
+ context = RequestContext(self.request)
+ tmpl = template.loader.get_template('contacts/zone.html')
+ return tmpl.render(context)
+
+
+class ContactsZone(TemplateView):
+ template_name = 'contacts/zone.html'
+
+ def get_context_data(self, **kwargs):
+ context = super(ContactsZone, self).get_context_data(**kwargs)
+ return context
+
+zone = csrf_exempt(ContactsZone.as_view())
+
+
+def search_json(request):
+ query = request.GET.get('q')
+ result = []
+ response = HttpResponse(content_type='application/json')
+ json.dump({'data': result}, response, indent=2)
+ return response
diff --git a/welco/settings.py b/welco/settings.py
index a5ae869..c94aeb8 100644
--- a/welco/settings.py
+++ b/welco/settings.py
@@ -44,6 +44,7 @@ INSTALLED_APPS = (
'welco.sources.mail',
'welco.qualif',
'welco.kb',
+ 'welco.contacts',
'gadjo',
)
diff --git a/welco/templates/welco/home.html b/welco/templates/welco/home.html
index df88168..bac86e8 100644
--- a/welco/templates/welco/home.html
+++ b/welco/templates/welco/home.html
@@ -14,17 +14,7 @@
{% trans 'Contacts' %}
-
-
+ {{ contacts.render }}
{% trans 'Qualification' %}
diff --git a/welco/urls.py b/welco/urls.py
index a8abc69..9486273 100644
--- a/welco/urls.py
+++ b/welco/urls.py
@@ -35,6 +35,9 @@ urlpatterns = patterns('',
url(r'^kb/(?P[\w-]+)/edit$', 'welco.kb.views.page_edit', name='kb-page-edit'),
url(r'^kb/(?P[\w-]+)/delete$', 'welco.kb.views.page_delete', name='kb-page-delete'),
+ url(r'^ajax/contacts$', 'welco.contacts.views.zone', name='contacts-zone'),
+ url(r'^contacts/search/json/$', 'welco.contacts.views.search_json', name='contacts-search-json'),
+
url(r'^admin/', include(admin.site.urls)),
url(r'^logout/$', 'welco.views.logout', name='auth_logout'),
url(r'^login/$', 'welco.views.login', name='auth_login'),
diff --git a/welco/views.py b/welco/views.py
index c5f305d..96e36e8 100644
--- a/welco/views.py
+++ b/welco/views.py
@@ -35,6 +35,7 @@ except ImportError:
from sources.mail.views import Home as MailHome
from .qualif.models import Association, FormdefReference
from .kb.views import HomeZone as KbHomeZone
+from .contacts.views import HomeZone as ContactsHomeZone
from .forms import QualificationForm
@@ -95,6 +96,7 @@ class Home(TemplateView):
context = super(Home, self).get_context_data(**kwargs)
context['source'] = MailHome(self.request)
context['kb'] = KbHomeZone(self.request)
+ context['contacts'] = ContactsHomeZone(self.request)
return context
home = Home.as_view()