Re: forms.form_for_model

2007-12-27 Thread mike
I finally got it working without using formfield callbacks, I used the "Modifying it Inline" portion of your post, thx for all of the help. Here is a snipped in case it helps anyone else, @staff_member_required def add_edit_customer(request, id=None): if id is None: CustomerEntryForm

Re: forms.form_for_model

2007-12-27 Thread mike
Yes, I found your post a while back, that is where I am learning most of this, great post. I tried this and got 'ModPythonRequest' object has no attribute 'customer' I think i am close though, here is my code: else: IssueEntryForm = forms.form_for_model(Issue, fields=('issue''customer

Re: forms.form_for_model

2007-12-26 Thread Empty
> Thanks for the reply I tried using the method you described and > searched the __init__.py, but just couldnt make any sense of it, > > def my_callback(field, **kwargs): > if f.name == 'customer': >return f.formfield(formfclass=forms.HiddenInput) Since you're receiving the fi

Re: forms.form_for_model

2007-12-26 Thread mike
Thanks for the reply I tried using the method you described and searched the __init__.py, but just couldnt make any sense of it, def my_callback(field, **kwargs): if f.name == 'customer': return f.formfield(formfclass=forms.HiddenInput) gives me global name 'f' is not defined

Re: forms.form_for_model

2007-12-21 Thread Malcolm Tredinnick
On Fri, 2007-12-21 at 06:48 -0800, mike wrote: > Sorry if I was unclean, I just discovered this and I am still learning > newforms, I am using forms.form_for_model and trying to get two form > to display in my template, only 1 is a foreign key that I used > edit_inline with my model, I am trying

Re: forms.form_for_model

2007-12-21 Thread mike
The issues model is a foreign key to my customer model. On Dec 21, 10:40 pm, mike <[EMAIL PROTECTED]> wrote: > Thank you for your reply, I did as you suggested but when I save the > form I get the error > > (1048, "Column 'customer_id' cannot be null") customer_id, being the > 'id' field of the

Re: forms.form_for_model

2007-12-21 Thread mike
The issues model is a foreign key to my customer model. On Dec 21, 10:40 pm, mike <[EMAIL PROTECTED]> wrote: > Thank you for your reply, I did as you suggested but when I save the > form I get the error > > (1048, "Column 'customer_id' cannot be null") customer_id, being the > 'id' field of the

Re: forms.form_for_model

2007-12-21 Thread mike
Thank you for your reply, I did as you suggested but when I save the form I get the error (1048, "Column 'customer_id' cannot be null") customer_id, being the 'id' field of the customer model, if request.method == 'POST': form1 = IssueEntryForm(request.POST) if form1.is_valid(

Re: forms.form_for_model

2007-12-21 Thread rskm1
Ahh! That helps. Sorry, I haven't ever used form_for_model() and didn't recognize that IssueEntryForm in the original post was NOT a form instance. Corrections embedded below. On Dec 21, 8:48 am, mike <[EMAIL PROTECTED]> wrote: > Sorry if I was unclean, I just discovered this and I am still l

Re: forms.form_for_model

2007-12-21 Thread mike
Sorry if I was unclean, I just discovered this and I am still learning newforms, I am using forms.form_for_model and trying to get two form to display in my template, only 1 is a foreign key that I used edit_inline with my model, I am trying to get the 'customer' field of my issue to be hidden and

Re: forms.form_for_model

2007-12-20 Thread rskm1
On Dec 20, 2:58 pm, mike <[EMAIL PROTECTED]> wrote: > anyone know how to auto assign a variable to my form field? > > IssueEntryForm.base_fields['customer'].widget = widgets.HiddenInput() > IssueEntryForm.base_fields['customer'].widget = HELP I'm not sure I understand the question; what exactly d