mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #24578 -- Fixed crash with QuerySet.update() on FK to O2O fields.
Thanks Anssi Kääriäinen for review.
This commit is contained in:
@@ -878,7 +878,7 @@ class Model(six.with_metaclass(ModelBase)):
|
||||
def prepare_database_save(self, field):
|
||||
if self.pk is None:
|
||||
raise ValueError("Unsaved model instance %r cannot be used in an ORM query." % self)
|
||||
return getattr(self, field.remote_field.field_name)
|
||||
return getattr(self, field.remote_field.get_related_field().attname)
|
||||
|
||||
def clean(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user