Fix unnecessary query at registration of custom models.

This caused imports errors, because it invokes the ORM while the
registration call is typically made from an `models.py` or `__init__.py` file.
Add __repr__ to UrlType class.