web/lib/django/db/models/fields/files.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
--- a/web/lib/django/db/models/fields/files.py	Wed May 19 17:43:59 2010 +0200
+++ b/web/lib/django/db/models/fields/files.py	Tue May 25 02:43:45 2010 +0200
@@ -1,7 +1,8 @@
-import copy
 import datetime
 import os
 
+import django.utils.copycompat as copy
+
 from django.conf import settings
 from django.db.models.fields import Field
 from django.core.files.base import File, ContentFile
@@ -216,6 +217,8 @@
     # The descriptor to use for accessing the attribute off of the class.
     descriptor_class = FileDescriptor
 
+    description = ugettext_lazy("File path")
+
     def __init__(self, verbose_name=None, name=None, upload_to='', storage=None, **kwargs):
         for arg in ('primary_key', 'unique'):
             if arg in kwargs:
@@ -232,12 +235,12 @@
     def get_internal_type(self):
         return "FileField"
 
-    def get_db_prep_lookup(self, lookup_type, value):
+    def get_prep_lookup(self, lookup_type, value):
         if hasattr(value, 'name'):
             value = value.name
-        return super(FileField, self).get_db_prep_lookup(lookup_type, value)
+        return super(FileField, self).get_prep_lookup(lookup_type, value)
 
-    def get_db_prep_value(self, value):
+    def get_prep_value(self, value):
         "Returns field's value prepared for saving into a database."
         # Need to convert File objects provided via a form to unicode for database insertion
         if value is None:
@@ -325,6 +328,7 @@
 class ImageField(FileField):
     attr_class = ImageFieldFile
     descriptor_class = ImageFileDescriptor
+    description = ugettext_lazy("File path")
 
     def __init__(self, verbose_name=None, name=None, width_field=None, height_field=None, **kwargs):
         self.width_field, self.height_field = width_field, height_field