### Navigation

- index
- modules |
- next |
- previous |
- FeinCMS 1.7.4 documentation »

# Media library

## Models

class `feincms.module.medialibrary.models.``Category`(*args, **kwargs)

  These categories are meant primarily for organizing media files in the library.

class `feincms.module.medialibrary.models.``CategoryManager`

  Simple manager which exists only to supply `.select_related("parent")` on querysets since we can’t even __unicode__ efficiently without it.

class `feincms.module.medialibrary.models.``MediaFile`(*args, **kwargs)

  MediaFile(id, file, type, created, copyright, file_size)

class `feincms.module.medialibrary.models.``MediaFileBase`(*args, **kwargs)

  Abstract media file class. Includes the `feincms.models.ExtensionsMixin` because of the (handy) extension mechanism.

  `determine_file_type`(name)

        >>> t = MediaFileBase()
        >>> t.determine_file_type('foobar.jpg')
        'image'
        >>> t.determine_file_type('foobar.PDF')
        'pdf'
        >>> t.determine_file_type('foobar.jpg.pdf')
        'pdf'
        >>> t.determine_file_type('foobar.jgp')
        'other'
        >>> t.determine_file_type('foobar-jpg')
        'other'

class `feincms.module.medialibrary.models.``MediaFileTranslation`(*args, **kwargs)

  Translated media file caption and description.

## Admin classes

`feincms.module.medialibrary.zip.``import_zipfile`(category_id, overwrite, data)

  Import a collection of media files from a zip file.

  category_id: if set, the pk of a Category that all uploaded
    files will have added (eg. cathegory “newly uploaded files”)
  overwrite: attempt to overwrite existing files. This might
    not work with non-trivial storage handlers

## Fields

class `feincms.module.medialibrary.fields.``MediaFileForeignKey`(to, to_field=None, rel_class=<class 'django.db.models.fields.related.ManyToOneRel'>, db_constraint=True, **kwargs)

  Drop-in replacement for Django’s `models.ForeignKey` which automatically adds a thumbnail of media files if the media file foreign key is shown using `raw_id_fields`.

### Navigation

- index
- modules |
- next |
- previous |
- FeinCMS 1.7.4 documentation »