Ticket #17761: django-17761.patch

File django-17761.patch, 824 bytes (added by Aron Grififs, 13 years ago)
  • django/db/models/base.py

     
    500500                # At this point, parent's primary key field may be unknown
    501501                # (for example, from administration form which doesn't fill
    502502                # this field). If so, fill it.
    503                 if field and getattr(self, parent._meta.pk.attname) is None and getattr(self, field.attname) is not None:
     503                if field and getattr(self, parent._meta.pk.attname) in [None, ''] and getattr(self, field.attname) is not None:
    504504                    setattr(self, parent._meta.pk.attname, getattr(self, field.attname))
    505505
    506506                self.save_base(cls=parent, origin=org, using=using)
Back to Top