from django.shortcuts import render, redirect
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from . import models
def index(request):
context = models.user.objects.all()
return render(request, 'mydata/index.html', {'context': context})
def add(request):
username = request.POST['username']
pwd = request.POST['pwd']
models.user.objects.create(username=username, pwd=pwd)
# return HttpResponseRedirect('/mydata/index/')
# redirect('mydata:index')
return HttpResponseRedirect('/mydata/index/')
redirect和HttpResponseRedirect重定向问题:
猜你喜欢
转载自blog.csdn.net/qq_33867131/article/details/80757881
今日推荐
周排行