python - How to add new columns to django userprofile model -
i have added 1 custom field phone
django user authentication. till worked properly. later added 1 more custom field called permissions
. after facing error message when try access admin page. here model.py
code
from django.contrib.auth.models import user django.db import models class userprofile(models.model): # line required. links userprofile user model instance. user = models.onetoonefield(user) class meta: permissions = ( ("ssc_1","can access ssc locked questions"), ) # additional attributes wish include. phone = models.charfield(max_length =20) permission = models.integerfield() # override __unicode__() method return out meaningful! def __unicode__(self): return self.user.username
i have followed this stackoverflow answer, when issue python manage.py migrate
command, getting error message
return database.cursor.execute(self, query, params) django.db.utils.operationalerror: table "users_userprofile" exists
note : django versions 1.6.6
thanks
migrations introduced in django 1.7. until south being used handle migrations
Comments
Post a Comment