2020-12-08 'max_length' is too small to fit the longest value in 'choices' (6 characters)

Today I got an specific error message like this

(env) ↪ python3 gealtikdemo/manage.py runserver 9898
Watching for file changes with StatReloader
Performing system checks...

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/home/bima/.local/lib/python3.6/site-packages/django/utils/autoreload.py", line 53, in wrapper
    fn(*args, **kwargs)
  File "/home/bima/.local/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 118, in inner_run
    self.check(display_num_errors=True)
  File "/home/bima/.local/lib/python3.6/site-packages/django/core/management/base.py", line 442, in check
    raise SystemCheckError(msg)
django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS:
blog.AuthorProfile.gender: (fields.E009) 'max_length' is too small to fit the longest value in 'choices' (6 characters).

System check identified 1 issue (0 silenced).

projectname>blog>models.py>AuthorProfile

go to blog sections (based on error) and then search in AuthorProfile about gender.

What's error? Because I set max_length smaller than option in mygender_choices, so that my database will show DatabaseError;

Solved with:

set the max_length to 6 or above

Last updated

Was this helpful?