Ticket #6755: django-admin-nodup.patch

File django-admin-nodup.patch, 800 bytes (added by sloonz, 7 years ago)

Fix (just a try...)

  • django/db/models/base.py

     
    291291            signal = False
    292292
    293293        for parent, field in meta.parents.items():
     294            # At this point, parent's primary key field may be unknown
     295            # (for example, from administration form which doesn't fill
     296            # this field). If so, fill it.
     297            if getattr(self, parent._meta.pk.attname) is None and getattr(self, field.attname) is not None:
     298                setattr(self, parent._meta.pk.attname, getattr(self, field.attname))
     299
    294300            self.save_base(raw, parent)
    295301            setattr(self, field.attname, self._get_pk_val(parent._meta))
    296302
Back to Top