48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
# 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 <http://www.gnu.org/licenses/>.
|
|
|
|
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
|