Django 1.1 rev 11018

stores = ReleaseStoreLink.objects.filter(release=self) \
                    .select_related('store','store__contact') \
                    .only('url','store__name','store__contact__url')

ss = stores[0]

ReleaseStoreLink has a method logo, it is not a db field

when using this object in a template I call {{ ss.logo }} on it

this does not call the method logo() as usually happens in a template,

it throws this error
*** TypeError: coercing to Unicode: need string or buffer, long found


which is the same error I get if trying to access ss.logo in a shell:
(Pdb) ss.logo
*** TypeError: coercing to Unicode: need string or buffer, long found

this is what I wanted:
(Pdb) ss.logo()
<ImageFieldFile: http://www.boomkat.com/>


in a similar fashion, I expect that since release ( a foreign key ) is
deferred, it should at this point fetch the release when accessed

but instead it returns the id

(Pdb) ss.release
67L

am I misunderstanding, shouldn't it now go fetch the (fk) release ?

this is what the ss object really is:
(Pdb) ss.__class__
<class 'music.models.ReleaseStoreLink_Deferred_release'>


thanks to anyone who has been through this.  I can't find much online yet.

-fx

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

Reply via email to