Browse files

Use `LOOKUP_SEP` in `get_or_create`.

  • Loading branch information...
1 parent a98465c commit 356443fd956c45e66c24256edc8f673d773b6ac8 @charettes charettes committed Apr 18, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/db/models/query.py
View
4 django/db/models/query.py
@@ -466,14 +466,14 @@ def get_or_create(self, **kwargs):
return self.get(**lookup), False
except self.model.DoesNotExist:
try:
- params = dict([(k, v) for k, v in kwargs.items() if '__' not in k])
+ params = dict((k, v) for k, v in kwargs.items() if LOOKUP_SEP not in k)
params.update(defaults)
obj = self.model(**params)
sid = transaction.savepoint(using=self.db)
obj.save(force_insert=True, using=self.db)
transaction.savepoint_commit(sid, using=self.db)
return obj, True
- except IntegrityError as e:
+ except IntegrityError:
transaction.savepoint_rollback(sid, using=self.db)
exc_info = sys.exc_info()
try:

0 comments on commit 356443f

Please sign in to comment.