Fixes issue with custom user models in Django 1.5

Saw this (#265) and ran into the same problem with the username not showing when using a custom user in Django 1.5. This appears to fix the issue with Django 1.5 and is backwards compatible with Django 1.4. It's definitely longer than I'd like it to be (maybe a templatetag would be better?), but I tested it in Django 1.4 and Django 1.5 and it appears to have no ill side-effects.