Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use `LOOKUP_SEP` in `get_or_create`.

  • Loading branch information...
commit 356443fd956c45e66c24256edc8f673d773b6ac8 1 parent a98465c
Simon Charette authored April 18, 2013

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/db/models/query.py
4  django/db/models/query.py
@@ -466,14 +466,14 @@ def get_or_create(self, **kwargs):
466 466
             return self.get(**lookup), False
467 467
         except self.model.DoesNotExist:
468 468
             try:
469  
-                params = dict([(k, v) for k, v in kwargs.items() if '__' not in k])
  469
+                params = dict((k, v) for k, v in kwargs.items() if LOOKUP_SEP not in k)
470 470
                 params.update(defaults)
471 471
                 obj = self.model(**params)
472 472
                 sid = transaction.savepoint(using=self.db)
473 473
                 obj.save(force_insert=True, using=self.db)
474 474
                 transaction.savepoint_commit(sid, using=self.db)
475 475
                 return obj, True
476  
-            except IntegrityError as e:
  476
+            except IntegrityError:
477 477
                 transaction.savepoint_rollback(sid, using=self.db)
478 478
                 exc_info = sys.exc_info()
479 479
                 try:

0 notes on commit 356443f

Please sign in to comment.
Something went wrong with that request. Please try again.