#11855: ImageField .path attribute does not take into account upload_to
pre-save -
Django 1.1
----------------------------------------------------+-----------------------
Reporter: djm | Owner: nobody
Status: new | Milestone:
Component: File uploads/storage | Version: 1.1
Keywords: FileField, ImageField, path, attribute | Stage: Unreviewed
Has_patch: 0 |
----------------------------------------------------+-----------------------
I'm not sure if this was an intentional change with Django and I couldn't
find a related ticket/general information on the subject so here goes:
With Django 1.0, when overriding the save() method on model that has an
{{{ImageField}}} (let's name the field "logo"), the full (absolute) system
path of the file was available by using {{{self.logo.path}}} before and
after calling {{{super(ModelName, self).save()}}}.
On a clean install of 1.1 however, with the field {{{logo =
models.ImageField(upload_to="uploads/img/logos/")}}} and {{{save()}}}
method as below:
{{{
def save(self):
print self.logo.path
super(Exhibitor, self).save()
print self.logo.path
}}}
the following is observed:
{{{
/home/djm/sites/projectname/media/Firefox_wallpaper.png
/home/djm/sites/projectname/media/uploads/img/logos/Firefox_wallpaper_.png
}}}
As you can see, the "upload_to" part of the path is missing pre-save. Is
this right - or should I just not be trying to use the .path attribute
pre-save?
--
Ticket URL: <http://code.djangoproject.com/ticket/11855>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---