2016-12-06 19:38:43 +00:00
|
|
|
from urllib.request import urlopen
|
|
|
|
|
2018-11-04 18:03:20 +00:00
|
|
|
from django.http import HttpResponse, StreamingHttpResponse
|
2018-12-06 15:08:01 +00:00
|
|
|
from django.views.decorators.csrf import csrf_exempt
|
2015-01-28 12:35:27 +00:00
|
|
|
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
from .models import Person
|
|
|
|
|
|
|
|
|
|
|
|
def example_view(request):
|
|
|
|
return HttpResponse('example view')
|
|
|
|
|
|
|
|
|
2018-11-04 18:03:20 +00:00
|
|
|
def streaming_example_view(request):
|
|
|
|
return StreamingHttpResponse((b'I', b'am', b'a', b'stream'))
|
|
|
|
|
|
|
|
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
def model_view(request):
|
|
|
|
people = Person.objects.all()
|
2013-08-29 23:20:00 +00:00
|
|
|
return HttpResponse('\n'.join(person.name for person in people))
|
Fixed #2879 -- Added support for the integration with Selenium and other in-browser testing frameworks. Also added the first Selenium tests for `contrib.admin`. Many thanks to everyone for their contributions and feedback: Mikeal Rogers, Dirk Datzert, mir, Simon G., Almad, Russell Keith-Magee, Denis Golomazov, devin, robertrv, andrewbadr, Idan Gazit, voidspace, Tom Christie, hjwp2, Adam Nelson, Jannis Leidel, Anssi Kääriäinen, Preston Holmes, Bruno Renié and Jacob Kaplan-Moss.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17241 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2011-12-22 08:33:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
def create_model_instance(request):
|
|
|
|
person = Person(name='emily')
|
|
|
|
person.save()
|
2012-10-20 10:34:50 +00:00
|
|
|
return HttpResponse('')
|
|
|
|
|
|
|
|
|
|
|
|
def environ_view(request):
|
2013-08-29 23:20:00 +00:00
|
|
|
return HttpResponse("\n".join("%s: %r" % (k, v) for k, v in request.environ.items()))
|
2016-12-06 19:38:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def subview(request):
|
|
|
|
return HttpResponse('subview')
|
|
|
|
|
|
|
|
|
|
|
|
def subview_calling_view(request):
|
2017-06-05 13:56:51 +00:00
|
|
|
with urlopen(request.GET['url'] + '/subview/') as response:
|
|
|
|
return HttpResponse('subview calling view: {}'.format(response.read().decode()))
|
2016-12-06 19:38:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def check_model_instance_from_subview(request):
|
2017-06-05 13:56:51 +00:00
|
|
|
with urlopen(request.GET['url'] + '/create_model_instance/'):
|
|
|
|
pass
|
|
|
|
with urlopen(request.GET['url'] + '/model_view/') as response:
|
|
|
|
return HttpResponse('subview calling view: {}'.format(response.read().decode()))
|
2018-12-06 15:08:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
@csrf_exempt
|
|
|
|
def method_view(request):
|
|
|
|
return HttpResponse(request.method)
|