Ticket #8748: primkey_inline.diff

File primkey_inline.diff, 1013 bytes (added by bromske, 15 years ago)
  • models.py

     
    119119    opts = instance._meta
    120120    data = {}
    121121    for f in opts.fields + opts.many_to_many:
    122         if not f.editable:
     122        if not f.editable and not f.primary_key:
    123123            continue
    124124        if fields and not f.name in fields:
    125125            continue
     
    153153    field_list = []
    154154    opts = model._meta
    155155    for f in opts.fields + opts.many_to_many:
    156         if not f.editable:
     156        if not f.editable and not f.primary_key:
    157157            continue
    158158        if fields and not f.name in fields:
    159159            continue
    160160        if exclude and f.name in exclude:
    161161            continue
    162162        formfield = formfield_callback(f)
     163
     164        if not f.editable:
     165            formfield.widget.id_for_label=None
     166            formfield.widget.input_type='hidden'
     167       
    163168        if formfield:
    164169            field_list.append((f.name, formfield))
    165170    return SortedDict(field_list)
Back to Top