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'))
        entry = get_object_or_404(Customer, pk=id)
        issues = Issue.objects.filter(name=entry.name)
        CustomerEntryForm = forms.form_for_instance(entry)
        cust1 = Customer.objects.get(pk=id)
        issues = Issue.objects.filter(customer=cust1).order_by('-
date')
   IssueEntryForm.base_fields['customer'].widget =
widgets.HiddenInput()
   IssueEntryForm.base_fields['customer'].required = False

   if request.method == 'POST':
        form = CustomerEntryForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect('.')
   if request.method == 'POST':
        form1 = IssueEntryForm(request.POST)
        if form1.is_valid():
            entry = form1.save(commit=False)
            entry.customer = request.customer
            entry.save()
            return HttpResponseRedirect('.')
   else:
        form = CustomerEntryForm()
        form1 = IssueEntryForm()
   return render_to_response('add_edit_customer.html', {'form':
form,'issues':issues,'form1':form1})


On Dec 26, 6:52 pm, Empty <[EMAIL PROTECTED]> wrote:
> > 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 field as 'field' that's what you need to use:
>
> See my post here:http://blog.michaeltrier.com/2007/11/23/customizing-newforms
>
> It shows exactly what you are trying to do in the section on formfield
> callbacks.
>
> Michael Trier
> blog.michaeltrier.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