#5029: newforms FileField special file naming requirements
-----------------------------------------------+----------------------------
Reporter: Øyvind Saltvik <[EMAIL PROTECTED]> | Owner: jacob
Status: new | Component: Uncategorized
Version: SVN | Keywords: file naming
newforms filefield
Stage: Unreviewed | Has_patch: 0
-----------------------------------------------+----------------------------
Would be nice if the FileField allowed files to be saved based on other
attributes on the model.
This requires setting those attributes before the save_form_data (new in
#3297) is called by the form to save the file.
The best would be to make this a spechial case that handles those fields
last, not only FileFields but any field that requires other model data.
If the saving needs a pk, so the filename/dir of the file is based on the
model instance pk. save_form_data shold be called right after commit and
save the model instance again. Preferably once and not one save per field.
The problem with saving twice is if the field has null=False the insert
would fail because of missing data on the instance, the solution would be
to handle the field both before and after commit. Setting the attribute to
'' before the insert, then saving the file on the update.
--
Ticket URL: <http://code.djangoproject.com/ticket/5029>
Django Code <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
-~----------~----~----~----~------~----~------~--~---