#11228: FieldFile with check if file exists.
------------------------------------------+---------------------------------
 Reporter:  hersonls                      |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  SVN       
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  1                             |  
------------------------------------------+---------------------------------
 Many people ask and also has the need to verify that the file is sent to
 the server is really in its place.

 This need arises because they are made unnecessary requests for lack of
 the file in media server and also for reasons of aesthetics, because the
 lack of image files or result in a different box with alt attribute, or
 result in a 404 not found.

 The class FieldFile not give the developer the possibility to check if
 file exists and that is the developers create a method in a class model
 which will check if file exists on the media server or not.

 I created a patch where it created a method for class FieldFile call
 is_exists which checks if the file exists. This method is valid for all
 inheritance of FieldFile class.

 For example,

 {{{
 {% if object.file.is_exists %}<a href="{{ MEDIA_URL }}{{ object.file
 }}">download this file</a>{% endif %}
 {% if object.image.is_exists %}<img src="{{ MEDIA_URL }}{{ object.image
 }}" alt="My image" />{% endif %}
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11228>
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to