Malcolm, Thank you so much for discovering my problem, I was hoping it was the newforms code and not mine ;-P.
Yea, that form= trick seems to work, not sure why, but it does. I've also seen the callback one too, but that seemed rather complicated, and I'm not much for complicated code :- I'll download the latest newforms code and try again, thanks so much. John On May 21, 7:29 pm, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Tue, 2007-05-22 at 02:14 +0000, John M wrote: > > Malcolm, > > > Here is the traceback from line 41: > > c:\python24\lib\site-packages\django\newforms\models.py in > > save_instance > > > 34. opts = instance.__class__._meta > > 35. if form.errors: > > 36. raise ValueError("The %s could not be changed because the data > > didn't validate." % opts.object_name) > > 37. clean_data = form.clean_data > > 38. for f in opts.fields: > > 39. if not f.editable or isinstance(f, models.AutoField): > > 40. continue > > > 41. setattr(instance, f.name, clean_data[f.name]) ... > > > 42. if commit: > > 43. instance.save() > > 44. for f in opts.many_to_many: > > 45. setattr(instance, f.attname, clean_data[f.name]) > > 46. # GOTCHA: If many-to-many data is given and commit=False, the > > many-to > > > I'm not sure what version I'll have to check. > > OK, that code's broken. > > Looks like you've just rediscovered byg #3635. This was fixed after 0.96 > came out, but you could grab the change mentioned there and apply it to > your local copy if you wanted to. > > > The reason for using the HoldingForm is to eliminate the display of > > the FK (another long post of mine), not so much adding fields, but to > > limit them. > > I'm not sure if that's really going to work, but it might. I can't see > how it's excluding fields in form_for_model, since that iterates through > all the fields anyway. But whatever floats your boat, I guess. If it > works, so be it. > > In 0.96, you could exclude fields by using formfield_callback and > passing it a function that returned None for fields you didn't want to > include. So if your "form" trick doesn't work, you might want to > investigate that. We've (by "we", I mean "Russell") fixed this in a > nicer way on trunk so that you can pass in a list of fields to include > in the form. > > Regards, > Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---