Make identifier tolerant of different sorts of primary keys

This is a fix for an issue related to issue #399 (https://github.com/toastdriven/django-haystack/issues/399).

I had an issue running the tests. Nothing would run (even before I'd made any changes) because `SITE_ID` wasn't set in the settings. I set that temporarily and the tests all ran fine.