def set_primary(self):
query = EmailAddress.objects.filter(is_primary=True, user=self.user)<EOL>query = query.exclude(pk=self.pk)<EOL>with transaction.atomic():<EOL><INDENT>query.update(is_primary=False)<EOL>self.is_primary = True<EOL>self.save()<EOL><DEDENT>logger.info(<EOL>"<STR_LIT>",<EOL>self.email,<EOL>self.user,<EOL>)<EOL>
Set this email address as the user's primary email.