Skip to content
Discussion options

You must be logged in to vote

you going to be frustrated with this one 🤣 🤣

The error is because of this line:

algorithm = table_column.CharField(blank=True, null=True)

Django requires that you set a max_length for CharFields -- and an error is only raised for some databases (see their docs on it). Postgres is the one database where max_length is optional.

To fix it, just add a max_length OR you can just switch to TextField where there is no limit:

# OPTION 1
algorithm = table_column.CharField(blank=True, null=True, max_length=100)

# OPTION 2
algorithm = table_column.TextField(blank=True, null=True)

[[ EDIT: as @SWeav02 mentioned, make sure you clear your old migrations too ]]

Django could be better with the error mes…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SWeav02
Comment options

Answer selected by jacksund
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants