I am new to django as well as python. I am trying to create a registration and login form.The test registration page works with only the username, email and password. When i try to add firstname, lastname fields for my registration form there was no problem but when i added a new field mobilexnumber, when I go to the admin page, I get the following error
OperationalError at /admin/registration/register/
(1054, "Unknown column 'registration_register.mobilexnumber' in 'field list'")
models.py
class Register(models.Model):
username = models.CharField(max_length=30)
email = models.EmailField(max_length=254)
password = models.CharField(max_length=30)
firstname = models.CharField(max_length=50)
lastname = models.CharField(max_length=50)
mobilexnumber = models.CharField(max_length=50)
samplefld = models.CharField(max_length=30)
forms.py
class RegForm(forms.ModelForm):
class Meta:
model = Register
fields = ('username', 'email', 'password', 'firstname', 'lastname','mobilexnumber', 'samplefld', )
widgets = {
'password': forms.PasswordInput(),
}
Dont mind the samplefld. It was used for some error checking. Even without this field I get the same error.
I am using the following:
Django ver 1.9
Python ver 2.7.11
Pycharm ver 5.0.2
mySQL as database
Thanks!