>
> Of course, one solution is to name your files after the pk of the
> record they're associated with, so new uploads will overwrite old
> ones.  This is a bit difficult to implement, but it's been 
> done:http://code.djangoproject.com/wiki/CustomUploadAndFilters

Also check out the (rather old) verdjnlib.PhotoField, referenced on
that page.
We borrowed the convention in this in many apps which let end users
upload
photos into a CMS (e.g. go to http://travel.reportlab.com and see the
'how it works' page).

It strictly enforces the name on the server so your image goes in,
e.g.,
  MEDIA/uploads/modelname/pk-fieldname.jpg

Thus, your image would go in
  MEDIA/uploads/userprofile/3-mugshot.png
for user 3.

This is a great default convention if you enforce it from the word go.
I wish it was Django's default behaviour.  User uploaded data is still
data which needs to be managed and backed up, and if it has
a structured naming convention, it really helps.

The only thing better would be storing BLOBS in the database table
directly
(he says, donning an asbestos suit and running for cover...;-)  )

- Andy Robinson, ReportLab
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to