[Answer]-Saving additional information to the database conditionally when using a modelfrom in django

1👍

Yes, that is exactly the right thing to do.

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

Leave a comment