django-select2/tests/testapp/views.py

18 lines
505 B
Python
Raw Normal View History

2015-03-03 09:01:51 +00:00
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
from django.http import HttpResponse
from django.views.generic import FormView
2015-03-03 09:01:51 +00:00
class TemplateFormView(FormView):
template_name = 'form.html'
def heavy_data(request):
numbers = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five']
results = [{'id': index, 'text': value} for (index, value) in enumerate(numbers)]
return HttpResponse(json.dumps({'err': 'nil', 'results': results}), content_type='application/json')