0
Djangoアプリケーションを作成しました。アプリケーションにはユーザーregstrationページがあります。登録ページが実装されており、登録後に電子メール確認を実装しようとしていました。すなわち、ユーザが登録されたときに電子メールを送信する。これをやっている間、私はこのエラーに遭遇しました。 "'str'オブジェクトはアイテムの割り当てをサポートしていません。誰かが私にこれを解決するのを助けることができますか?ここに私のコードを貼り付けます。'str'オブジェクトはアイテムの割り当てをサポートしていません - djangoのエラー
def registrationForm(request):
if request.method == "POST":
firstName = request.POST.get("firstName")
lastName = request.POST.get("lastName")
email = request.POST.get("email")
password = request.POST.get("password")
sex = request.POST.get("sex")
birthday = request.POST.get("birthday")
print request.POST.get("sex")
UniversityDetails(firstName=firstName,lastName=lastName,email=email,password=password,sex=sex,birthday=birthday).save()
msg = "Registration Successfull"
msg['Subject'] = 'The contents of %s'
msg['From'] = me
msg['To'] =you
s = smtplib.SMTP()
s.sendmail(me, [you], msg.as_string())
s.quit()
return render_to_response('registrationForm.html')
return render_to_response("registrationForm.html")
HTML
<form name ="myform" method="POST" id='FormID'>
<table>
<tr>
<td>First name</td>
<td>
<input type="text" name="firstName" value="" maxlength="100" />
<b id="firstNameID" style="font-family:Times New Roman;color:#B4045F;font-size:14px;">
</td>
</tr>
<tr>
<td>Last name</td>
<td>
<input type="text" name="lastName" value="" maxlength="100" />
</td>
</tr>
<tr>
<td>E-mail</td>
<td>
<input type="text" name="email" value="" maxlength="100" />
</td>
</tr>
<tr>
<td>Password</td>
<td>
<input type="password" name="password" value="" maxlength="100" />
<b id="passwordID" style="font-family:Times New Roman;color:#B4045F;font-size:14px;">
</td>
</tr>
<tr>
<td>Gender:</td>
<td>
<input type="radio" name="sex" value="male" /> Male
<input type="radio" name="sex" value="female" /> Female
</td>
</tr>
<tr>
<td>Birthday</td>
<td>
<input type="text" name="birthday" id='datepicker' value="" maxlength="100" />
</td>
</tr>
</tr>
</table>
<script type="text/javascript">
function isEmpty(){
if ((document.myform.firstName.value.length==0))
{
document.getElementById('firstNameID').innerHTML = 'Please fill this field';
return true;
}
else if ((document.myform.password.value.length==0))
{
document.getElementById('passwordID').innerHTML = 'Please fill this field';
return true;
}
else if (! ValidCaptcha())
{txtCaptcha
alert("Captcha entered wrong");
}
else
{
document.getElementById('FormID').action = "http://10.1.0.90:8080/registrationForm/";
document.getElementById('FormID').submit();
return false;
}
}
</script>
エラーメッセージを貼り付け、エラーを報告している行を示します。 –
私もトレースバックを貼り付けました。 –