python - How to Lengthen the Username Field on Django User Model? -
i have django web application deployed on heroku. i'm using django's user model authentication. goal lengthen username
field 30 characters 100 characters.
i overrode default user
model own abstractuser
model:
class abstractuser(abstractbaseuser, permissionsmixin): username = models.charfield( _('username'), max_length=30, unique=true, help_text=_('required. 100 characters or fewer. letters, digits , @/./+/-/_ only.'), validators=[ validators.regexvalidator( r'^[\w.@+-]+$', _('enter valid username. value may contain ' 'letters, numbers ' 'and @/./+/-/_ characters.') ), ], error_messages={ 'unique': _("a user username exists."), }, ) first_name = models.charfield(_('first name'), max_length=30, blank=true) last_name = models.charfield(_('last name'), max_length=30, blank=true) email = models.emailfield(_('email address'), blank=true) is_staff = models.booleanfield( _('staff status'), default=false, help_text=_('designates whether user can log admin site.'), ) is_active = models.booleanfield( _('active'), default=true, help_text=_( 'designates whether user should treated active. ' 'unselect instead of deleting accounts.' ), ) date_joined = models.datetimefield(_('date joined'), default=timezone.now)
i want update max_length of username
field 30 100. can locally without issue updating line max_length=30
max_length=100
, running python manage.py makemigrations
, python manage.py migrate
.
however, migration file created in virtual environment (venv\lib\site-packages\django\contrib\auth\migrations)
folder i'm not sure deploy heroku. have entire venv folder excluded through .gitignore
file. not have venv folder on heroku.
where/how should deploy , apply migration file heroku?
Comments
Post a Comment