diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2009-11-03 14:02:49 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2009-11-03 14:02:49 +0000 |
| commit | 585b7acaa359fc1df07269c1a4b4756bdb6703f7 (patch) | |
| tree | 8fd3d96de629257ee7bb51e757e20b74df6b3f22 /django/db/models/base.py | |
| parent | aba5389326372be43b2a3bdcda16646fd197e807 (diff) | |
Fixed #10109 -- Removed the use of raw SQL in many-to-many fields by introducing an autogenerated through model.
This is the first part of Alex Gaynor's GSoC project to add Multi-db support to Django.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@11710 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/base.py')
| -rw-r--r-- | django/db/models/base.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index ce8dda204a..c7f6ba2f7c 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -434,7 +434,7 @@ class Model(object): else: meta = cls._meta - if origin: + if origin and not meta.auto_created: signals.pre_save.send(sender=origin, instance=self, raw=raw) # If we are in a raw save, save the object exactly as presented. @@ -507,7 +507,7 @@ class Model(object): setattr(self, meta.pk.attname, result) transaction.commit_unless_managed() - if origin: + if origin and not meta.auto_created: signals.post_save.send(sender=origin, instance=self, created=(not record_exists), raw=raw) @@ -544,7 +544,12 @@ class Model(object): rel_descriptor = cls.__dict__[rel_opts_name] break else: - raise AssertionError("Should never get here.") + # in the case of a hidden fkey just skip it, it'll get + # processed as an m2m + if not related.field.rel.is_hidden(): + raise AssertionError("Should never get here.") + else: + continue delete_qs = rel_descriptor.delete_manager(self).all() for sub_obj in delete_qs: sub_obj._collect_sub_objects(seen_objs, self.__class__, related.field.null) |
