#4022: Problem with select fields and foreign keys
-----------------------------+----------------------------------------------
Reporter:  [EMAIL PROTECTED]  |       Owner:  jacob        
  Status:  new               |   Component:  Uncategorized
 Version:  0.96              |    Keywords:               
   Stage:  Unreviewed        |   Has_patch:  0            
-----------------------------+----------------------------------------------
 I posted a similar message to this on the django users list a couple days
 ago but go no response, so it's possible this is actually a bug (not just
 a user error :)).
 
 The problem is with values not getting saved in 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.
 
 Let me know if there's any other information I can provide.
 
 - Scott

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4022>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to