Ticket #12819: 12307-onetoone-null.patch

File 12307-onetoone-null.patch, 639 bytes (added by s.angel@…, 15 years ago)
  • django/db/models/query.py

     
    12021202                # If the base object exists, populate the
    12031203                # descriptor cache
    12041204                setattr(obj, f.get_cache_name(), rel_obj)
    1205             if f.unique:
     1205            if f.unique and rel_obj is not None:
    12061206                # If the field is unique, populate the
    12071207                # reverse descriptor cache on the related object
    12081208                setattr(rel_obj, f.related.get_cache_name(), obj)
Back to Top