Hi guys,
I'm trying to create a login form using a model form,
user model:
class users(models.Model):
username = models.CharField(max_length=20, primary_key=True)
password = models.CharField(max_length=50)
usertype = models.CharField(max_length=20)
class Meta:
db_table = u'users'
login form:
class loginlorm(forms.ModelForm):
class Meta:
model = users
fields = ('username','password','usertype')
widgets = {
'username':TextInput(),
'password':PasswordInput(),
'usertype':Select(choices=(("t1","type1"),
("t2","type2"))),
}
The form comes up as i wanted it to, but when i login it gives a
validation error saying "user with this name already exists".
I think its "form.is_valid()" checking "primary key" constraint,
thinking i'm trying to write into the table. :(
I cant remove the "primary key" constraint on "username" is there a
way around this problem..
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.