django generic view update/create: update works but create raises IntegrityError

Posted by smarber on Stack Overflow See other posts from Stack Overflow or by smarber
Published on 2013-10-30T20:47:03Z Indexed on 2013/10/30 21:54 UTC
Read the original article Hit count: 341

I'm using CreateView and UpdateView directely into urls.py of my application whose name is dydict. In the file forms.py I'm using ModelForm and I'm exluding a couple of fields from being shown, some of which sould be set when either creating or updating. So, as mentioned in the title, update part works but create part doesn't which is obvious because required fields that I have exluded are sent empty which is not allowed in my case. So the question here is, how should I do to fill exluded fields into the file forms.py so that I don't have to override CreateView?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about django

Related posts about django-forms