On Sun, Apr 3, 2011 at 11:33 PM, xiao_haozi <[email protected]> wrote:

> from shortener.models import url
> url = u'http://t04u.be/'
>

In the 1st line you are importing a model (?) named url.

In the 2nd you are discarding that url you just imported and rebinding the
name url to a unicode string. You no longer have any reference to what you
imported from shortener.models.

Any attempt to use the name url as though it were the thing you imported is
now going to give odd results (like the TypeError you reported).

Don't name your variables the same as your models/classes. If you followed
the CapWords convention for Python class names (and lowercase convention for
variables) this would be less likely to happen.

Karen
-- 
http://tracey.org/kmt/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to