Fixed #1729 -- Changed get_FIELD_filename() to return an empty string when field fiel's value is null. Thanks, rhettg@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2839 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-05-05 02:59:58 +00:00
parent adf6126c81
commit 775c06a959
2 changed files with 4 additions and 1 deletions

View File

@ -97,6 +97,7 @@ answer newbie questions, and generally made Django that much better:
Daniel Poelzleithner <http://poelzi.org/> Daniel Poelzleithner <http://poelzi.org/>
J. Rademaker J. Rademaker
Brian Ray <http://brianray.chipy.org/> Brian Ray <http://brianray.chipy.org/>
rhettg@gmail.com
Oliver Rutherfurd <http://rutherfurd.net/> Oliver Rutherfurd <http://rutherfurd.net/>
Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/> Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/>
David Schein David Schein

View File

@ -281,7 +281,9 @@ class Model(object):
return getattr(self, cachename) return getattr(self, cachename)
def _get_FIELD_filename(self, field): def _get_FIELD_filename(self, field):
return os.path.join(settings.MEDIA_ROOT, getattr(self, field.attname)) if getattr(self, field.attname): # value is not blank
return os.path.join(settings.MEDIA_ROOT, getattr(self, field.attname))
return ''
def _get_FIELD_url(self, field): def _get_FIELD_url(self, field):
if getattr(self, field.attname): # value is not blank if getattr(self, field.attname): # value is not blank