Example #1
0
File: views.py Project: wjxwjx/wjx1
def toaddauthored(request):
        author=Author()
        author.name=request.GET['name']
        author.age=request.GET['age']
        author.country=request.GET['country']
        author.AuthorID=request.GET['authorid']
        author.save()
        return render_to_response('addauthorsucceed.html')  
Example #2
0
def addAuthorSucceed(request):
    author1 = Author()
    if request.POST:
        author1.AuthorID = request.POST["AuthorID"]
        author1.Name = request.POST["Name"]
        author1.Country = request.POST["Country"]
        author1.Age = request.POST["Age"]
        if author1.AuthorID and author1.Name:
            id1 = author1.AuthorID
            try:
                q = Author.objects.get(AuthorID=id1)
                return render(request, "existAuthorID.html", {"author1": q})
            except:
                author1.save()
                return render(request, "addAuthorSucceed.html")
        else:
            return render(request, "addAuthorFailure.html")