﻿#!/usr/bin/env python  
# -*- coding:utf-8 -*-  
"""
Definition of views.
"""

from django.shortcuts import render
from django.http import HttpRequest
from django.template import RequestContext
from datetime import datetime

def home(request):
    """Renders the home page."""
    assert isinstance(request, HttpRequest)
#写在这个位置吗 
    list1 = ['physics', 'chemistry', 1997, 2000]
    return render(
        request,
        'app/index.html',
        {
            'arr':list1,
            'title':'AskShare',
            'year':datetime.now().year,
        }
    )

def contact(request):
    """Renders the contact page."""
    assert isinstance(request, HttpRequest)
    return render(
        request,
        'app/contact.html',
        {
            'title':'Contact',
            'message':'Your contact page.',
            'year':datetime.now().year,
        }
    )

def about(request):
    """Renders the about page."""
    assert isinstance(request, HttpRequest)
    return render(
        request,
        'app/about.html',
        {
            'title':'About',
            'message':'Your application description page.',
            'year':datetime.now().year,
        }
    )
def register(request):
    """Renders the about page."""
    assert isinstance(request,HttpRequest)
    return render(
        request,
        'app/account/register.html',
        {
             'title':'http://localhost:60122/',
        }
    )
def register_post(request):
    assert isinstance(request,HttpRequest)
    ctx = {}
    if request.POST:
        ctx['rlt'] = request.POST['q']
    return render(request, "post.html", ctx)
