[Answered ]-Views error in Django


I think the problem is in line

per_job = Personal(cd['Name'], cd['Email_ID'], cd['Address'], cd['Contact_Phone'], cd['Image'])

I don’t know if it’s possible to create a model instance with only positional parameters, but it’s not mentioned in the docs. You should be using keyword parameters:

per_job = Personal(name=cd['Name'], email=cd['Email_ID'], etc.

The error you’re seeing probably results from trying to assing non-integer value to the default database field with object ID, so it might be caused by this.

Regarding the other things:

  • Image is not stored probably because you’re not using form attribute enctype="multipart/form-data" which is required for correctly processing uploaded files.
  • The errors are not displayed most probably because they’re contained in the form after validation, and you’re replacing that with an empty instance in else: branch of your uregister view.

Leave a comment