[Answer]-Django NOT NULL constraint failed: pages_newlist.user_id

1👍

Fixing Image Not Posting

Needed to add enctype to template:

<form method = "POST" action = "" enctype="multipart/form-data">
                    {% csrf_token %}

                        {{ form }}

</form>

Populating User To Current User

Needed to just assign user for the entry to request.user

    form = NewListForm(request.POST, request.FILES)

    if form.is_valid():
        save_it = form.save(commit = False)
        save_it.user = request.user
        save_it.save()

Leave a comment