I have the following model:
class Pet(models.Model):
name = models.CharField(max_length=64)
picture = models.ImageField(upload_to='/usr/django/images/')
def save(self, force_insert=False, force_update=False):
// override the picture values
super(Pet, self).save(force_insert, force_update) # Call the
"real" save() method.
I want to achieve the following:
- Any uploaded pet image will have the following name on the file
system <pet_id>.<img_extension>, for example
/usr/django/images/1.jpg, /usr/django/images/2.gif
- How can can I retrieve the image extension, override the save method
and store it in the column picture?
The Pet table will look something like:
id name picture
1 Pluto jpg
2 Scooby gif
All the above is done on the admin side.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---