from django.shortcuts import render
from .forms import RegisterForm
def register(request):
if request.method=='POST':
form=RegisterForm(request.POST)
if form.is_valid():
name=form.cleaned_data['username']
password=form.cleaned_data['password']
email=form.cleaned_data['email']
gender=form.cleaned_data['gender']
form.save()
form=RegisterForm()
return render(request, 'form.html', {'form': form})'
当我尝试将数据从表单保存到数据库时,我得到: AttributeError: 'RegisterForm' 对象没有属性 'save'
请有人帮我解决这个问题。