(instance, file_attr='file')
return {
        'url': obj.url,
        'name': order_name(obj.name),
        'type': mimetypes.guess_type(obj.path)[0] or 'image/png',
        'thumbnailUrl': obj.url,
        'size': obj.size,
        'deleteUrl': "/delete/"+str(instance.pk),
        'deleteType': 'DELETE',
    }
serialize -- Serialize a Picture instance into a dict.

    instance -- Picture instance
    file_attr -- attribute name that contains the FileField or ImageField
serialize -- Serialize a Picture instance into a dict.
serialize -- Serialize a Picture instance into a dict .
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 {
        'url': obj.url,
        'name': order_name(obj.name),
        'type': mimetypes.guess_type(obj.path)[0] or 'image/png',
        'thumbnailUrl': obj.url,
        'size': obj.size,
        'deleteUrl': "/delete/"+str(instance.pk),
        'deleteType': 'DELETE',
    }
def serialize ( instance , file_attr = 'file' ) : obj = getattr ( instance , file_attr ) return { 'url' : obj . url , 'name' : order_name ( obj . name ) , 'type' : mimetypes . guess_type ( obj . path ) [ 0 ] or 'image/png' , 'thumbnailUrl' : obj . url , 'size' : obj . size , 'deleteUrl' : "/delete/" + str ( instance . pk ) , 'deleteType' : 'DELETE' , }