#2380: ChangeManipulator's and ManyToManyFields (do not show up in resulting
FormWrapper)
---------------------------------+------------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: jacob
Type: defect | Status: new
Priority: normal | Milestone:
Component: Documentation | Version:
Severity: normal | Resolution:
Keywords: |
---------------------------------+------------------------------------------
Comment (by [EMAIL PROTECTED]):
fyi - the code I use in the "GET" to get around this is:
{{{
else:
# This was NOT a POST. We want to just display the object with any
# form fields filled in from the actual object's data, with no
errors
# in the form.
#
errors = {}
new_data = obj.__dict__
# Now, new_data will not contain any of our editable
ManyToManyField
# data since those fields are not part of obj.__dict__, so go
through
# the fields in our model, and for any field that is ManyToMany
_and_
# editable get the set of all objects and put it in that field.
#
for field in klass._meta.many_to_many:
if isinstance(field, models.fields.related.ManyToManyField)
and field.editable:
new_data[field.name] = getattr(obj,field.name).all()
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/2380>
Django <http://code.djangoproject.org/>
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
-~----------~----~----~----~------~----~------~--~---