Ticket #2579: fix_raw_id_admin_m2m.patch

File fix_raw_id_admin_m2m.patch, 754 bytes (added by brendan.mcadams@…, 9 years ago)

Fix to skip 'empty' defined raw_id_admin fields and prevent errors

  • django/db/models/manipulators.py

    old new  
    118118                if not f.rel.edit_inline:
    119119                    if f.rel.raw_id_admin:
    120120                        new_vals = new_data.get(f.name, ())
     121                        # Not handling 'empty' raw_id_admin fields properly
     122                        # If nothing was entered, skip the rel manager add
     123                        if len(new_vals) == 1 and '' == new_vals[0]:
     124                            continue
    121125                    else:
    122126                        new_vals = new_data.getlist(f.name)
    123127                    # First, clear the existing values.
Back to Top