mirror of
https://github.com/django/django.git
synced 2025-10-26 07:06:08 +00:00
Fixed #1579 - added support for 'Q' objects in limit_choices_to.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2850 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -261,9 +261,9 @@ class AutomaticChangeManipulator(AutomaticManipulator):
|
||||
# Sanity check -- Make sure the "parent" object exists.
|
||||
# For example, make sure the Place exists for the Restaurant.
|
||||
# Let the ObjectDoesNotExist exception propagate up.
|
||||
lookup_kwargs = self.opts.one_to_one_field.rel.limit_choices_to
|
||||
lookup_kwargs['%s__exact' % self.opts.one_to_one_field.rel.field_name] = obj_key
|
||||
self.opts.one_to_one_field.rel.to.get_model_module().get(**lookup_kwargs)
|
||||
limit_choices_to = self.opts.one_to_one_field.rel.limit_choices_to
|
||||
lookup_kwargs = {'%s__exact' % self.opts.one_to_one_field.rel.field_name: obj_key}
|
||||
self.opts.one_to_one_field.rel.to.get_model_module().complex_filter(limit_choices_to).get(**lookup_kwargs)
|
||||
params = dict([(f.attname, f.get_default()) for f in self.opts.fields])
|
||||
params[self.opts.pk.attname] = obj_key
|
||||
self.original_object = self.opts.get_model_module().Klass(**params)
|
||||
|
||||
Reference in New Issue
Block a user