[Answered ]-Crispy_forms.exceptions.CrispyError: |as_crispy_field got passed an invalid or inexistent field โ€“ models.ForeignKey

1๐Ÿ‘

โœ…

You are not passing the form through the context in the template. As you are inheriting View, Add the following line in the get() and afterwards in the post() method appropriately:

form = NewHandoffForm()

# and then change return
return render(request,'handoff/handoff-new.html', {'form': form })

Also, you have a space after render in the get function. I hope this is a typo here, but not in your code.

๐Ÿ‘คrs_punia

Leave a comment