Skip to content

Commit

Permalink
Fix IntegrityError in User._migrate_alerts_to_user()
Browse files Browse the repository at this point in the history
Set ProductAlert.email and ProductAlert.key to '' instead of None since
the fields are non nullable.
  • Loading branch information
mvantellingen committed Dec 22, 2015
1 parent 02af3d3 commit 8ef1bef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/oscar/apps/customer/abstract_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _migrate_alerts_to_user(self):
ProductAlert = self.alerts.model
alerts = ProductAlert.objects.filter(
email=self.email, status=ProductAlert.ACTIVE)
alerts.update(user=self, key=None, email=None)
alerts.update(user=self, key='', email='')

def save(self, *args, **kwargs):
super(AbstractUser, self).save(*args, **kwargs)
Expand Down

0 comments on commit 8ef1bef

Please sign in to comment.