Hi,

I'm having a problem with values not getting saved select fields.
Specifically, select fields that are referencing an external type.

Say I have a model such as:

class MyModel(models.Model):
  field1 = models.ForeignKey(Foo)
  field2 = models.CharField(choices = (('1', 'first choice'), ('2', 'second
choice')))

When I use a manipulator to build the form all goes smoothly. However, if I
select a value for field1 on the form, but not field2 I'll get an error
since field2 is required. But when this happens field1 gets reset, so the
value isn't being saved. If I go the other way, and set field2, but not
field1, I'll get an error message again but field2 will have its values
preserved.

Looking into the django code a bit I narrowed down the issue to the
django.oldforms.FormField.extract_data method. When it runs the line:
  data = data_dict.get(self.get_member_name(), None)

The data for field1 won't be returned. I believe this is because the
'member_name' for field1 is field1_id, but the 'field_name' is field1.

Hopefully what I've just said makes sense. I'm quite new to django so it's
very possible that I'm just using something wrong or left something out of
my model that should have been there.

Thanks for any help!
Scott

--~--~---------~--~----~------------~-------~--~----~
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