Issues with counting uuid in Postgresql
Thanks for including the traceback. Looks like the exception itself got cut off. Could you please include that? Will make debugging a bit easier... I'm just guessing here, but is psycopg2 already providing a uuid and peewee is treating it like it's a string?
 All code with all traceback:

```
>>> from application.db.models import Department, User
>>> from application.db.models import db
>>> from peewee import fn
>>> k = Department.select(Department.prefix, fn.COUNT(User.id).alias('total_users')).join(User).group_by(Department.prefix).dicts()
>>> for t in k:
...     print t
... 
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2047, in next
    obj = self.qrw.iterate()
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2107, in iterate
    return self.process_row(row)
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2196, in process_row
    res[column] = func(row[i])
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 1105, in python_value
    return None if value is None else uuid.UUID(value)
  File "/usr/lib/python2.7/uuid.py", line 133, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'long' object has no attribute 'replace'
```
 Oh of course! Sorry, yes. For now you can work around this by calling:

``` python
fn.COUNT(User.id).coerce(False).alias('total_users')
```

But I am working up a patch to fix this.
 Fixed in b84ca0c8bc724b8cccd0b5bbd557abc04885c478

Issues with counting uuid, with other type fields the problem is avoid.

For example:

```
import peewee
from uuid import UUID

class User():
    id = UUIDField(primary_key=True)
    login = CharField()
    department = ForeignKeyField(Department, related_name=u"users_in_department", null=True)

class Department():
    id = UUIDField(primary_key=True)
    name = CharField()
```

Then:

```
d = (Department.select(
    Department.name,
    fn.COUNT(User.id).alias('total_users')
    ).join(User).group_by(Department.name))
for t in d:
    pass

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2047, in next
    obj = self.qrw.iterate()
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2107, in iterate
    return self.process_row(row)
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 2185, in process_row
    setattr(instance, column, func(row[i]))
  File "/usr/local/lib/python2.7/dist-packages/peewee.py", line 1105, in python_value
    return None if value is None else uuid.UUID(value)
  File "/usr/lib/python2.7/uuid.py", line 133, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
```

But `User.login` instead `User.id`

```
d = (Department.select(
    Department.name,
    fn.COUNT(User.login).alias('total_users')
    ).join(User).group_by(Department.name))
for t in d:
    pass
```

works correctly/
