Models Glossary

class MediaCategory

A user created collection of Media.

name

Required. A short name.

Maximum 64 characters.

Type:

str

cover

A cover image.

Type:

File | None

Value:

None

class Media

A user created published work.

title

Required. A short title.

Maximum 64 characters. Must be unique.

Type:

str

source

Required. A video or an image.

Type:

File

thumb

A thumbnail image.

Automatically generated on save if the media is a video.

Type:

File | None

Value:

None

subtitle

A medium-length subtitle.

Maximum 128 characters.

Type:

str | None

Value:

None

desc

A lengthy description.

Maximum 2048 characters.

Type:

str | None

Value:

None

slug

A slug generated from a title.

Type:

str | None

Value:

None

is_hidden

Whether or not the media is hidden.

Type:

bool

Value:

False

is_image

Whether or not the media is an image.

Set on Media.save().

Type:

bool | None

Value:

None

categories

Categories the media is a member of.

Type:

QuerySet | None

Value:

None

date_created

The date the user created the media.

Set on Media.create().

Type:

date

Value:

today()

datetime_published

The date and time the user created the media.

Set on Media.save(). Cannot be modified.

Type:

datetime

Value:

now()

set_thumbnail([file=None]) None

Sets the media’s thumbnail to the file.

If the file is None, instead sets the media’s thumbnail to the return value of generate_thumbnail().

Parameters:

file (File) – The new thumbnail.

Returns:

Nothing.

Return type:

None

Raises:

AssertionError – If the media is an image.

generate_thumbnail([loc=0]) File

Generates a thumbnail at frame loc.

Parameters:

loc (int) – The frame of the media to generate. Default is 0.

Returns:

A new thumbnail file.

Return type:

File

Raises: