diff --git a/django/contrib/sessions/backends/db.py b/django/contrib/sessions/backends/db.py
index 3dd0d95..eab9190 100644
a
|
b
|
class SessionStore(SessionBase):
|
53 | 53 | expire_date=self.get_expiry_date() |
54 | 54 | ) |
55 | 55 | using = router.db_for_write(Session, instance=obj) |
56 | | sid = transaction.savepoint(using=using) |
57 | | try: |
58 | | obj.save(force_insert=must_create, using=using) |
59 | | except IntegrityError: |
60 | | if must_create: |
| 56 | if must_create: |
| 57 | sid = transaction.savepoint(using=using) |
| 58 | try: |
| 59 | obj.save(force_insert=must_create, force_update=not must_create, using=using) |
| 60 | except IntegrityError: |
61 | 61 | transaction.savepoint_rollback(sid, using=using) |
62 | 62 | raise CreateError |
63 | | raise |
| 63 | else: |
| 64 | Session.objects.using(using).filter(pk=obj.session_key).update(session_data=obj.session_data, expire_date=obj.expire_date) |
64 | 65 | |
65 | 66 | def delete(self, session_key=None): |
66 | 67 | if session_key is None: |