'smart_get(integer) -> get object by ID
smart_get(string) -> get object by name_field'

@classmethod
def smart_get(cls, id_or_name, valid_only=True):

    if valid_only:
        manager = cls.get_valid_manager()
    else:
        manager = cls.objects
    if isinstance(id_or_name, (int, long)):
        return manager.get(pk=id_or_name)
    if (isinstance(id_or_name, basestring) and hasattr(cls, 'name_field')):
        return manager.get(**{cls.name_field: id_or_name})
    raise ValueError(('Invalid    positional    argument:    %s    (%s)' % (id_or_name, type(id_or_name))))
