[patch] Fetching the dimensions of an ImageField
>>> i.get_source_width()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/utils/functional.py", line 3, in _curried
return args[0](*(args[1:]+moreargs), **dict(kwargs.items() + morekwargs.items()))
File "/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/db/models/base.py", line 344, in _get_FIELD_width
return self._get_image_dimensions(field)[0]
File "/usr/lib/python2.4/site-packages/Django-0.91-py2.4.egg/django/db/models/base.py", line 353, in _get_image_dimensions
filename = self._get_FIELD_filename(field)()
TypeError: 'str' object is not callable
where "i" is an instance of an model with a ImageField
called source
. AFARI the problem is the ()
after the _get_FIELD_filename
call which returns the filename.
yeah, i've hit this one to.
dealing with a lot of image fields in my models i've
fixed the () and everything works fine :)
for people wanting a quick fix i've attached a patch to django/db/models/base.py