mirror of
https://github.com/django/django.git
synced 2024-12-22 09:05:43 +00:00
Fixed #3142 -- Optimized the assignment of m2m and m2o relation sets. Thanks, (and well spotted!) mitakummaa@gmail.com.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4231 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
069a8858ba
commit
2d6095ea5e
1
AUTHORS
1
AUTHORS
@ -123,6 +123,7 @@ answer newbie questions, and generally made Django that much better:
|
||||
Jason McBrayer <http://www.carcosa.net/jason/>
|
||||
mccutchen@gmail.com
|
||||
michael.mcewan@gmail.com
|
||||
mitakummaa@gmail.com
|
||||
mmarshall
|
||||
Eric Moritz <http://eric.themoritzfamily.com/>
|
||||
Robin Munn <http://www.geekforgod.com/>
|
||||
|
@ -256,8 +256,7 @@ class ForeignRelatedObjectsDescriptor(object):
|
||||
# Otherwise, just move the named objects into the set.
|
||||
if self.related.field.null:
|
||||
manager.clear()
|
||||
for obj in value:
|
||||
manager.add(obj)
|
||||
manager.add(*value)
|
||||
|
||||
def create_many_related_manager(superclass):
|
||||
"""Creates a manager that subclasses 'superclass' (which is a Manager)
|
||||
@ -405,8 +404,7 @@ class ManyRelatedObjectsDescriptor(object):
|
||||
|
||||
manager = self.__get__(instance)
|
||||
manager.clear()
|
||||
for obj in value:
|
||||
manager.add(obj)
|
||||
manager.add(*value)
|
||||
|
||||
class ReverseManyRelatedObjectsDescriptor(object):
|
||||
# This class provides the functionality that makes the related-object
|
||||
@ -447,8 +445,7 @@ class ReverseManyRelatedObjectsDescriptor(object):
|
||||
|
||||
manager = self.__get__(instance)
|
||||
manager.clear()
|
||||
for obj in value:
|
||||
manager.add(obj)
|
||||
manager.add(*value)
|
||||
|
||||
class ForeignKey(RelatedField, Field):
|
||||
empty_strings_allowed = False
|
||||
|
Loading…
Reference in New Issue
Block a user