Hello,

How do I add a field that is required by my database but excluded in my 
forms.py? I used ModelForm class to define my forms but in the meta class I 
excluded one of the required fields so i can add it later in my views.py. I 
tried adding the value using the save(commit = False) like this:

if request.method == 'POST':
        form = forms.Model2FromClass(request.POST)
        if form.is_valid():
            formInstance = form.save(commit = False)
            formInstance.required_field = value
            formInstance.save()
            return HttpResponseRedirect("on/success")

I get an IntegrityError saying that the required_field cannot be null.
I also tried defining, in the form class,  a new function that sets this 
variable but results in the same error. Can somebody please help me i don't 
know what i am doing wrong or not doing.

Thanks in advance,
 
Jorge Hugo Murillo





      
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.  
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to