old_contents: # encoding: utf-8
  import mimetypes
  import re
  from django.core.urlresolvers import reverse
  
  
  def order_name(name):
      """order_name -- Limit a text to 20 chars length, if necessary strips the
      middle of the text and substitute it for an ellipsis.
  
      name -- text to be limited.
  
      """
      name = re.sub(r'^.*/', '', name)
      if len(name) <= 20:
          return name
      return name[:10] + "..." + name[-7:]
  
  
  def serialize(instance, file_attr='file'):
      """serialize -- Serialize a Picture instance into a dict.
  
      instance -- Picture instance
      file_attr -- attribute name that contains the FileField or ImageField
  
      """
      obj = getattr(instance, file_attr)
      return {
          'resource_id': instance.pk,
          'url': obj.url,
          'file_type': obj.file_type,
          'name': order_name(obj.name),
          'type': mimetypes.guess_type(obj.path)[0] or 'image/png',
          'thumbnailUrl': obj.url,
          'size': obj.size,
          'deleteUrl': reverse('upload-delete', args=[instance.pk]),
          'deleteType': 'DELETE',
      }
  
  
  
new_contents: # encoding: utf-8
  import mimetypes
  import re
  from django.core.urlresolvers import reverse
  
  
  def order_name(name):
      """order_name -- Limit a text to 20 chars length, if necessary strips the
      middle of the text and substitute it for an ellipsis.
  
      name -- text to be limited.
  
      """
      name = re.sub(r'^.*/', '', name)
      if len(name) <= 20:
          return name
      return name[:10] + "..." + name[-7:]
  
  
  def serialize(instance, file_attr='file'):
      """serialize -- Serialize a Picture instance into a dict.
  
      instance -- Picture instance
      file_attr -- attribute name that contains the FileField or ImageField
  
      """
      obj = getattr(instance, file_attr)
      return {
          'resource_id': instance.pk,
          'url': obj.url,
          'file_type': instance.file_type,
          'name': order_name(obj.name),
          'type': mimetypes.guess_type(obj.path)[0] or 'image/png',
          'thumbnailUrl': obj.url,
          'size': obj.size,
          'deleteUrl': reverse('upload-delete', args=[instance.pk]),
          'deleteType': 'DELETE',
      }
  
  
  
subject: FIX add links to reports generated v2