Ticket #3142: faster_m2m_assignment.diff

File faster_m2m_assignment.diff, 781 bytes (added by mitakummaa@…, 9 years ago)

Patch against trunk r4201

  • django/db/models/fields/related.py

     
    405405
    406406        manager = self.__get__(instance)
    407407        manager.clear()
    408         for obj in value:
    409             manager.add(obj)
     408        manager.add(*value)
    410409
    411410class ReverseManyRelatedObjectsDescriptor(object):
    412411    # This class provides the functionality that makes the related-object
     
    447446
    448447        manager = self.__get__(instance)
    449448        manager.clear()
    450         for obj in value:
    451             manager.add(obj)
     449        manager.add(*value)
    452450
    453451class ForeignKey(RelatedField, Field):
    454452    empty_strings_allowed = False
Back to Top