PyCon/pycon — pull request #323 by rebecca-caktus (2014-09-18 18:33:18+00:00)
Title: Fix bug when trying to add speaker

```
File "symposion/proposals/views.py", line 153, in proposal_speaker_manage
speaker, token = create_speaker_token(email_address)

File "symposion/proposals/views.py", line 117, in create_speaker_token
invite_token=token,

File "django/db/models/manager.py", line 149, in create
return self.get_query_set().create(**kwargs)

File "django/db/models/query.py", line 416, in create
obj.save(force_insert=True, using=self.db)

....

IntegrityError: duplicate key value violates unique constraint "speakers_speaker_invite_email_key"
DETAIL: Key (invite_email)=(*******) already exists.
```

Looks like the code was trying to create a speaker that already exists. My best guess is that the user was trying to add a speaker who has an account with an unconfirmed email address. Because the email address is unconfirmed, `EmailAddress.objects.get_users_for(email_address)` returns no users, even though one does exist.

Since `email_address` is unique on the `Speaker` model, that should be sufficient to look up the `Speaker` in this case.