diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:57:25 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-09-15 21:57:25 +0000 |
| commit | ca33d307dee3cf68cc9cd2ccfae00c7ff23ea890 (patch) | |
| tree | e0f0afa392f4ab50de4a89e2a0b1b4cc53f40794 /django/db/models/base.py | |
| parent | 7325fbf4ff20f9b0f21d3a1aba1abaca78a765d7 (diff) | |
queryset-refactor: Merged to [6300]
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@6340 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models/base.py')
| -rw-r--r-- | django/db/models/base.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/models/base.py b/django/db/models/base.py index b728150a40..208dfadddd 100644 --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -247,6 +247,7 @@ class Model(object): qn(self._meta.order_with_respect_to.column)) cursor.execute(subsel, (getattr(self, self._meta.order_with_respect_to.attname),)) db_values.append(cursor.fetchone()[0]) + record_exists = False if db_values: cursor.execute("INSERT INTO %s (%s) VALUES (%s)" % \ (qn(self._meta.db_table), ','.join(field_names), @@ -261,7 +262,8 @@ class Model(object): transaction.commit_unless_managed() # Run any post-save hooks. - dispatcher.send(signal=signals.post_save, sender=self.__class__, instance=self) + dispatcher.send(signal=signals.post_save, sender=self.__class__, + instance=self, created=(not record_exists)) save.alters_data = True |
