Ignore:
Timestamp:
01/18/12 11:59:51 (9 years ago)
Author:
pcosquer
Message:

3D branch: merge changes from trunk (rev [661])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3D/openPLM/plmapp/views/api.py

    r368 r662  
    279279    fields = [] 
    280280    for field_name, field in form.fields.items(): 
    281         data = dict(name=field_name, label=field.label.capitalize(), initial=field.initial) 
    282         if callable(field.initial): 
    283             data["initial"] = field.initial() 
    284             if hasattr(data["initial"], "pk"): 
    285                 data["initial"] = data["initial"].pk 
     281        initial = form.initial.get(field_name, field.initial) 
     282        if callable(initial): 
     283            initial = initial() 
     284        if hasattr(initial, "pk"): 
     285            initial = initial.pk 
     286        data = dict(name=field_name, 
     287                    label=field.label.capitalize(), 
     288                    initial=initial, 
     289               ) 
    286290        data["type"] = field_to_type(field) 
    287291        if hasattr(field, "choices"): 
Note: See TracChangeset for help on using the changeset viewer.