#5505: Self-Referential ForeignKeys broken using newforms
-------------------------+--------------------------------------------------
   Reporter:  danlarkin  |                Owner:  nobody         
     Status:  new        |            Component:  django.newforms
    Version:  SVN        |           Resolution:                 
   Keywords:             |                Stage:  Unreviewed     
  Has_patch:  1          |           Needs_docs:  0              
Needs_tests:  0          |   Needs_better_patch:  0              
-------------------------+--------------------------------------------------
Changes (by danlarkin):

 * cc: [EMAIL PROTECTED] (added)
  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 After Malcom asked me to write a test around this issue I realized it's a
 lot more complex than I had initially thought.  "newforms-deepcopy.patch"
 does __not__ solve the problem.
 
 The error appears to happen only when using form_for_instance with the
 formfield_callback argument.  I *think* writing a !__deepcopy!__ method
 for django.db.models.fields.Field solves the problem.  I have written (and
 attached) three patches addressing this issue.
 
 "db-models-fields-init.patch" adds a !__deepcopy!__ method to
 django.db.models.fields.Field
 "newforms-forms.patch" fixes an issue I was having with !AutoField not
 having a widget attribute, and raising an exception when it tried to
 access it
 "tests-regressiontests-forms-models.patch" adds tests to display the
 issue.  Without the above two patches the test fails, and with the patches
 it passes.
 
 FYI, the patches are against trunk r6363
 
 
 Additionally, the !__deepcopy!__ method might not be correct; it
 definitely needs someone familiar with the codebase to examine it and
 determine the implications.  Works for me, though.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/5505#comment:1>
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