<form action="" method="post">
<div>
<label for="id_login">Логин:</label>
{{ form.login }}
</div>
</form>
class CreateProfileForm(forms.Form):
login = forms.CharField(max_length=150, required=True)
class Profile(models.Model):
login = models.CharField(max_length=150)
def enter_person(request):
if request.method == 'POST':
createProfileForm = CreateProfileForm(request.POST)
if createProfileForm.is_valid():
personData = createProfileForm.cleaned_data
if personData == None:
return HttpResponseRedirect(reverse('blog_arhive'))
profile = Profile()
profile.login = personData['login']
profile.save()
return HttpResponseRedirect(reverse('create_profile'))
else:
createProfileForm = CreateProfileForm()
t = loader.get_template("person/create_profile.html")
c = Context({'form': createProfileForm})
return HttpResponse(t.render(c))
Django Version: 1.2.1
Exception Type: TypeError
Exception Value: 'NoneType' object is unsubscriptable
На что мне следует обратить внимание? Почему не работает?
{update}
Чуть не забыл. Работаю с тестовым сервером, который к джанге прилагается. Может из-за этого?