[Answered ]-Django manytomany field invalid literal for int() with base 10: ''

2👍

The problem is that your ModuleForm is declaring goal to be a CharField. You’re telling Django that this should be a string, so when a value isn’t entered the empty string ('') gets passed to the database layer, which is expecting an integer.

The solution is simple: goal = forms.IntegerField(...). Make sure you do the same for your other fields (e.g. port, maxDisplay).

Leave a comment