node2:/django/mysite/blog#cat views.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# from django.shortcuts import render, render_to_response
from .models import *
# Create your views here.
from django.http import HttpResponse
from django.template import loader
def archive(req):
print 'aaaaaaaaaaaaaaaaaaaaaaaaaaa'
print req
print type(req)
print req.GET
print '#############################'
print req.GET['aa']
print req.GET['cc']
print '#############################'
print 'aaaaaaaaaaaaaaaaaaaaaaaaaaa'
# get all blogpost objects
posts = BlogPost.objects.all()
#print blog_list
template = loader.get_template('archive.html')
context = {
'posts':posts
}
print '------------------------------------------'
print HttpResponse(template.render(context, req))
print '------------------------------------------'
return HttpResponse(template.render(context, req))
node2:/django/mysite/blog#
http://192.168.137.3:8000/blog/?aa=1234&cc=5678
aaaaaaaaaaaaaaaaaaaaaaaaaaa
<WSGIRequest: GET '/blog/?aa=1234&cc=5678'>
<class 'django.core.handlers.wsgi.WSGIRequest'>
<QueryDict: {u'aa': [u'1234'], u'cc': [u'5678']}>
#############################
1234
5678
#############################
aaaaaaaaaaaaaaaaaaaaaaaaaaa