database - django not nullable error on model field containing null-True -
so have user can post comments on effects, im linking models , keep getting non-nullable error no matter ive tried. says needs have null=true. isn't working lol. not seeing here?
this official error:
django.db.utils.integrityerror: not null constraint failed: effect_modules_comment__new.author_id
and models:
class effect_module(models.model): created_at = models.datetimefield(auto_now_add=true) title = models.charfield(max_length=255) description = models.textfield() html = models.textfield(default='') css = models.textfield(default='') js = models.textfield(default='') up_votes = models.integerfield() down_votes = models.integerfield() effect_author = models.manytomanyfield('userprofile') class userprofile(models.model): user = models.onetoonefield(user) effects = models.manytomanyfield(effect_module) class comment(models.model): comment_author = models.foreignkey(user, null=true) comment = models.textfield(default='no comment here') effect_object = models.foreignkey(effect_module)
delete migration scripts. add null=true
means can null in database, blank=true
means can left blank in forms.
then
python manage.py makemigrations python manage.py migrate
Comments
Post a Comment