这是我的观点,我用一种形式来称呼它。当我提交表单时,我得到“'tuple' 对象没有属性 'id'”
@login_required
def _login_save(request, form):
if request.method == 'POST':
form = LoginSaveForm(request.POST)
if form.is_valid():
# Create or get login.
login1 = login.objects.get_or_create(
id=1 #this is for testing reasons to get a specific record
)
login1.name=form.cleaned_data['name']
login1.loginUrl = form.cleaned_data['url']
login1.password = form.cleaned_data['password']
login1.login_username = form.cleaned_data['Login_username']
login1.notes = form.cleaned_data['notes']
login1.save()
return login1