1 | in django/views/generic/create_update.py:
|
---|
2 | @@ -119,7 +119,15 @@
|
---|
3 | errors = {}
|
---|
4 | # This makes sure the form acurate represents the fields of the place.
|
---|
5 | new_data = object.__dict__
|
---|
6 | -
|
---|
7 | + #TODO(lambert): merge with latest django code when it comes out
|
---|
8 | + from django.views.admin.main import _get_mod_opts, _get_flattened_data
|
---|
9 | + mod, opts = _get_mod_opts(app_label, module_name)
|
---|
10 | + for f in opts.fields:
|
---|
11 | + new_data.update(_get_flattened_data(f, getattr(object, f.column)))
|
---|
12 | + for f in opts.many_to_many:
|
---|
13 | + if f.rel.raw_id_admin:
|
---|
14 | + new_data[f.name] = ",".join([str(i.id) for i in getattr(obj, 'get_%s_list' % f.rel.singular)()])
|
---|
15 | +
|
---|
16 | form = formfields.FormWrapper(manipulator, new_data, errors)
|
---|
17 | if not template_name:
|
---|
18 | template_name = "%s/%s_form" % (app_label, module_name)
|
---|