Ticket #30330: fix-30330.diff

File fix-30330.diff, 657 bytes (added by Florian Apolloner, 6 years ago)
  • django/db/models/deletion.py

    diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py
    index 92fe4affb9..883c09ef83 100644
    a b class Collector:  
    277277            if self.can_fast_delete(instance):
    278278                with transaction.mark_for_rollback_on_error():
    279279                    count = sql.DeleteQuery(model).delete_batch([instance.pk], self.using)
     280                # Set primary key to None
     281                setattr(instance, model._meta.pk.attname, None)
    280282                return count, {model._meta.label: count}
    281283
    282284        with transaction.atomic(using=self.using, savepoint=False):
Back to Top