marsha.core package¶
Subpackages¶
- marsha.core.migrations package
- Submodules
- marsha.core.migrations.0001_initial_models module
- marsha.core.migrations.0002_soft_deletion module
- marsha.core.migrations.0003_missing_text_fields module
- marsha.core.migrations.0004_duplicated_from__blank module
- marsha.core.migrations.0005_use_our__nondeleteduniqueindex module
- Module contents
- marsha.core.tests package
Submodules¶
marsha.core.admin module¶
Admin of the core
app of the Marsha project.
-
class
marsha.core.admin.
AudioTrackInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for audio tracks of a video.
-
media
¶
-
model
¶ alias of
marsha.core.models.AudioTrack
-
-
class
marsha.core.admin.
AuthorOrganizationsInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for organizations the user is an author of.
-
media
¶
-
model
¶ alias of
marsha.core.models.Authoring
-
verbose_name
= 'authoring organization'¶
-
verbose_name_plural
= 'authoring organizations'¶
-
-
class
marsha.core.admin.
BaseModelAdmin
(model, admin_site)[source]¶ Bases:
safedelete.admin.SafeDeleteAdmin
Base for all our model admins.
-
media
¶
-
-
class
marsha.core.admin.
BaseTabularInline
(parent_model, admin_site)[source]¶ Bases:
django.contrib.admin.options.TabularInline
Base for all our tabular inlines.
-
media
¶
-
-
class
marsha.core.admin.
ConsumerSiteAdmin
(model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseModelAdmin
Admin class for the ConsumerSite model.
-
inlines
= [<class 'marsha.core.admin.SiteAdminsInline'>, <class 'marsha.core.admin.SiteOrganizationsInline'>]¶
-
list_display
= ('name',)¶
-
media
¶
-
-
class
marsha.core.admin.
ManagedOrganizationsInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for organizations managed by a user.
-
media
¶
-
model
¶
-
verbose_name
= 'managed organization'¶
-
verbose_name_plural
= 'managed organizations'¶
-
-
class
marsha.core.admin.
MarshaAdminSite
(name='admin')[source]¶ Bases:
django.contrib.admin.sites.AdminSite
Admin site for Marsha.
-
site_header
= 'Marsha'¶
-
site_title
= 'Marsha administration'¶
-
-
class
marsha.core.admin.
OrganizationAdmin
(model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseModelAdmin
Admin class for the Organization model.
-
inlines
= [<class 'marsha.core.admin.OrganizationManagersInline'>, <class 'marsha.core.admin.OrganizationSitesInline'>, <class 'marsha.core.admin.OrganizationAuthorsInline'>]¶
-
list_display
= ('name',)¶
-
media
¶
-
-
class
marsha.core.admin.
OrganizationAuthorsInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for authors in an organization.
-
media
¶
-
model
¶ alias of
marsha.core.models.Authoring
-
verbose_name
= 'author'¶
-
verbose_name_plural
= 'authors'¶
-
-
class
marsha.core.admin.
OrganizationManagersInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for managers in an organization.
-
media
¶
-
model
¶
-
verbose_name
= 'manager'¶
-
verbose_name_plural
= 'managers'¶
-
-
class
marsha.core.admin.
OrganizationSitesInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for sites for an organization.
-
media
¶
-
model
¶ alias of
marsha.core.models.SiteOrganization
-
verbose_name
= 'site'¶
-
verbose_name_plural
= 'sites'¶
-
-
class
marsha.core.admin.
PlaylistAdmin
(model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseModelAdmin
Admin class for the Playlist model.
-
exclude
= ('duplicated_from',)¶
-
inlines
= [<class 'marsha.core.admin.PlaylistVideosInline'>, <class 'marsha.core.admin.PlaystlistAccessesInline'>]¶
-
list_display
= ('name', 'organization', 'author', 'is_public')¶
-
media
¶
-
-
class
marsha.core.admin.
PlaylistVideosInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for videos in a playlist.
-
media
¶
-
model
¶ alias of
marsha.core.models.PlaylistVideo
-
verbose_name
= 'video'¶
-
verbose_name_plural
= 'videos'¶
-
-
class
marsha.core.admin.
PlaystlistAccessesInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for with right to write access to a playlist.
-
media
¶
-
model
¶ alias of
marsha.core.models.PlaylistAccess
-
verbose_name
= 'user access'¶
-
verbose_name_plural
= 'users accesses'¶
-
-
class
marsha.core.admin.
SignTrackInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for sign tracks of a video.
-
media
¶
-
model
¶ alias of
marsha.core.models.SignTrack
-
-
class
marsha.core.admin.
SiteAdminsInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for admins of a site.
-
media
¶
-
model
¶ alias of
marsha.core.models.SiteAdmin
-
verbose_name
= 'admin'¶
-
verbose_name_plural
= 'admins'¶
-
-
class
marsha.core.admin.
SiteOrganizationsInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for organizations in a site.
-
media
¶
-
model
¶ alias of
marsha.core.models.SiteOrganization
-
verbose_name
= 'organization'¶
-
verbose_name_plural
= 'organizations'¶
-
-
class
marsha.core.admin.
SubtitleTrackInline
(parent_model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseTabularInline
Inline for subtitle tracks of a video.
-
media
¶
-
model
¶ alias of
marsha.core.models.SubtitleTrack
-
-
class
marsha.core.admin.
UserAdmin
(model, admin_site)[source]¶ Bases:
django.contrib.auth.admin.UserAdmin
Admin class for the User model.
-
inlines
= [<class 'marsha.core.admin.ManagedOrganizationsInline'>, <class 'marsha.core.admin.AuthorOrganizationsInline'>]¶
-
media
¶
-
-
class
marsha.core.admin.
VideoAdmin
(model, admin_site)[source]¶ Bases:
marsha.core.admin.BaseModelAdmin
Admin class for the Video model.
-
exclude
= ('duplicated_from',)¶
-
inlines
= [<class 'marsha.core.admin.AudioTrackInline'>, <class 'marsha.core.admin.SubtitleTrackInline'>, <class 'marsha.core.admin.SignTrackInline'>]¶
-
list_display
= ('name', 'author', 'language')¶
-
media
¶
-
marsha.core.apps module¶
Defines the django app config for the core
app.
marsha.core.base_models module¶
Base models for the core app of the Marsha project.
-
class
marsha.core.base_models.
BaseModel
(*args, **kwargs)[source]¶ Bases:
safedelete.models.SafeDeleteModel
Base model for all our models.
It is based on
SafeDeleteModel
to easily manage how we want the instances to be deleted/soft-deleted, with or without its relationships. The defaultsafedelete
policy isSOFT_DELETE_CASCADE
, ie the object to delete and its relations will be soft deleted: theirdeleted
field will be filled with the current date-time (the opposite,None
, is the same as “not deleted”)- Also it adds some checks run with
django check
: - check that all fields are correctly annotated.
- same for fields pointing to other models: final models must have all related
names properly annotated. - check that every
ManyToManyField
use a definedthrough
table. - check that every model have adb_table
defined, not prefixed with the name of the app or the project.
Parameters: deleted (DateTimeField) – Deleted -
classmethod
check
(**kwargs) → List[django.core.checks.messages.CheckMessage][source]¶ Add checks for related names.
Parameters: kwargs (Any) – Actually not used but asked by django to be present “for possible future usage”. Returns: A list of the check messages representing problems found on the model. Return type: List[checks.CheckMessage]
- Also it adds some checks run with
-
class
marsha.core.base_models.
NonDeletedUniqueIndex
(fields: Sequence, name: str = None) → None[source]¶ Bases:
psqlextra.indexes.conditional_unique_index.ConditionalUniqueIndex
A special ConditionalUniqueIndex for non deleted objects.
-
__init__
(fields: Sequence, name: str = None) → None[source]¶ Override default init to pass our predefined condition.
For the parameters, see
ConditionalUniqueIndex.__init__
.
-
condition
= '"deleted" IS NULL'¶
-
marsha.core.managers module¶
This module holds the managers for the marsha models.
marsha.core.models module¶
This module holds the models for the marsha project.
-
class
marsha.core.models.
AudioTrack
(*args, **kwargs)[source]¶ Bases:
marsha.core.models.BaseTrack
Model representing an additional audio track for a video.
Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- video (ForeignKey to
Video
) – video for which this track is - language (CharField) – language of this track
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
get_language_display
(*, field=<django.db.models.fields.CharField: language>)¶ Autogenerated: Shows the label of the
language
-
id
¶ Model field: ID
-
class
marsha.core.models.
Authoring
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing authors in an organization.
through
model betweenOrganization.authors
andUser.authoring
.Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- user (ForeignKey to
User
) – user having authoring access in this organization - organization (ForeignKey to
Organization
) – organization on which the user is an author
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ Model field: ID
-
organization
¶ Model field: organization, accesses the
Organization
model.
-
organization_id
¶ Model field: organization
-
user_id
¶ Model field: author
-
class
marsha.core.models.
BaseTrack
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Base model for different kinds of tracks tied to a video.
Parameters: - deleted (DateTimeField) – Deleted
- video (ForeignKey to
Video
) – video for which this track is - language (CharField) – language of this track
-
get_language_display
(*, field=<django.db.models.fields.CharField: language>)¶ Autogenerated: Shows the label of the
language
-
language
¶ Model field: track language
-
video_id
¶ Model field: video
-
class
marsha.core.models.
ConsumerSite
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing an external site with access to the Marsha instance.
Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- name (CharField) – Name of the site
- admins (ManyToManyField) – users able to manage this site
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
admins
¶ Model field: administrators, accesses the M2M
ConsumerSite
model.
-
id
¶ Model field: ID
-
name
¶ Model field: name
-
organizations
¶ Model field: sites, accesses the M2M
Organization
model.
-
organizations_links
¶ Model field: site, accesses the M2M
SiteOrganization
model.
-
class
marsha.core.models.
Organization
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing an organization to manage its playlists on one or many sites.
Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- name (CharField) – name of the organization
- sites (ManyToManyField) – sites where this organization is present
- managers (ManyToManyField) – users able to manage this organization
- authors (ManyToManyField) – users able to manage playlists in this organization
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
Model field: organization, accesses the M2M
Authoring
model.
Model field: authors, accesses the M2M
Organization
model.
-
id
¶ Model field: ID
-
managers
¶ Model field: managers, accesses the M2M
Organization
model.
-
managers_links
¶ Model field: organization, accesses the M2M
OrganizationManager
model.
-
name
¶ Model field: name
-
sites
¶ Model field: sites, accesses the M2M
Organization
model.
-
sites_links
¶ Model field: organization, accesses the M2M
SiteOrganization
model.
-
class
marsha.core.models.
OrganizationManager
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing managers of organizations.
through
model betweenOrganization.managers
andUser.managed_organizations
.Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- user (ForeignKey to
User
) – user managing this organization - organization (ForeignKey to
Organization
) – organization managed by this user
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ Model field: ID
-
organization
¶ Model field: organization, accesses the
Organization
model.
-
organization_id
¶ Model field: organization
-
user_id
¶ Model field: manager
-
class
marsha.core.models.
Playlist
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing a playlist which is a list of videos.
Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- name (CharField) – name of the playlist
- organization (ForeignKey to
Organization
) – Organization - author (ForeignKey to
User
) – Author - is_public (BooleanField) – if this playlist can be viewed without any access control
- duplicated_from (ForeignKey to
Playlist
) – original playlist this one was duplicated from - editors (ManyToManyField) – users allowed to manage this playlist
- videos (ManyToManyField) – videos in this playlist
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
Model field: author, accesses the
User
model.
Model field: author
-
duplicated_from_id
¶ Model field: duplicate from
-
id
¶ Model field: ID
-
is_public
¶ Model field: is public
-
name
¶ Model field: name
-
organization
¶ Model field: organization, accesses the
Organization
model.
-
organization_id
¶ Model field: organization
-
users_accesses
¶ Model field: playlist, accesses the M2M
PlaylistAccess
model.
-
videos_links
¶ Model field: playlist, accesses the M2M
PlaylistVideo
model.
-
class
marsha.core.models.
PlaylistAccess
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing a user having right to manage a playlist.
through
model betweenPlaylist.editors
andUser.managed_playlists
.Parameters: -
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ Model field: ID
-
playlist_id
¶ Model field: playlist
-
user_id
¶ Model field: user
-
exception
-
class
marsha.core.models.
PlaylistVideo
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing a video in a playlist.
through
model betweenPlaylist.videos
andVideo.playlists
.Parameters: -
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ Model field: ID
-
order
¶ Model field: order
-
playlist_id
¶ Model field: playlist
-
video_id
¶ Model field: video
-
exception
-
class
marsha.core.models.
SignTrack
(*args, **kwargs)[source]¶ Bases:
marsha.core.models.BaseTrack
Model representing a signs language track for a video.
Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- video (ForeignKey to
Video
) – video for which this track is - language (CharField) – language of this track
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
get_language_display
(*, field=<django.db.models.fields.CharField: language>)¶ Autogenerated: Shows the label of the
language
-
id
¶ Model field: ID
-
class
marsha.core.models.
SiteAdmin
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing users with access to manage a site.
through
model betweenConsumerSite.admins
andUser.administrated_sites
.Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- user (ForeignKey to
User
) – user with access to the site - site (ForeignKey to
ConsumerSite
) – site to which the user has access
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ Model field: ID
-
site
¶ Model field: site, accesses the
ConsumerSite
model.
-
site_id
¶ Model field: site
-
user_id
¶ Model field: user
-
class
marsha.core.models.
SiteOrganization
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing organizations in sites.
through
model betweenOrganization.sites
andConsumerSite.organizations
.Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- site (ForeignKey to
ConsumerSite
) – site having this organization - organization (ForeignKey to
Organization
) – organization in this site
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
id
¶ Model field: ID
-
organization
¶ Model field: organization, accesses the
Organization
model.
-
organization_id
¶ Model field: organization
-
site
¶ Model field: site, accesses the
ConsumerSite
model.
-
site_id
¶ Model field: site
-
class
marsha.core.models.
SubtitleTrack
(*args, **kwargs)[source]¶ Bases:
marsha.core.models.BaseTrack
Model representing a subtitle track for a video.
Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- video (ForeignKey to
Video
) – video for which this track is - language (CharField) – language of this track
- has_closed_captioning (BooleanField) – if closed captioning (for death or hard of hearing viewers) is on for this subtitle track
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
get_language_display
(*, field=<django.db.models.fields.CharField: language>)¶ Autogenerated: Shows the label of the
language
Model field: closed captioning
-
id
¶ Model field: ID
-
class
marsha.core.models.
User
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
,django.contrib.auth.models.AbstractUser
Model representing a user that can be authenticated to act on the Marsha instance.
Parameters: - id (AutoField) – Id
- password (CharField) – Password
- last_login (DateTimeField) – Last login
- is_superuser (BooleanField) – Designates that this user has all permissions without explicitly assigning them.
- username (CharField) – Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
- first_name (CharField) – First name
- last_name (CharField) – Last name
- email (EmailField) – Email address
- is_staff (BooleanField) – Designates whether the user can log into this admin site.
- is_active (BooleanField) – Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
- date_joined (DateTimeField) – Date joined
- deleted (DateTimeField) – Deleted
- groups (ManyToManyField) – The groups this user belongs to. A user will get all permissions granted to each of their groups.
- user_permissions (ManyToManyField) – Specific permissions for this user.
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
administrated_sites
¶ Model field: administrators, accesses the M2M
ConsumerSite
model.
Model field: authors, accesses the M2M
Organization
model.
Model field: author, accesses the M2M
Video
model.
Model field: author, accesses the M2M
Authoring
model.
-
get_next_by_date_joined
(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=True, **kwargs)¶ Autogenerated: Finds next instance based on
date_joined
.
-
get_previous_by_date_joined
(*, field=<django.db.models.fields.DateTimeField: date_joined>, is_next=False, **kwargs)¶ Autogenerated: Finds previous instance based on
date_joined
.
-
id
¶ Model field: ID
-
logentry_set
¶ Model field: user, accesses the M2M
LogEntry
model.
-
managed_organizations
¶ Model field: managers, accesses the M2M
Organization
model.
-
managed_organizations_links
¶ Model field: manager, accesses the M2M
OrganizationManager
model.
-
objects
= <marsha.core.managers.UserManager object>¶
-
playlists_accesses
¶ Model field: user, accesses the M2M
PlaylistAccess
model.
-
class
marsha.core.models.
Video
(*args, **kwargs)[source]¶ Bases:
marsha.core.base_models.BaseModel
Model representing a video, by an author.
Parameters: - id (AutoField) – Id
- deleted (DateTimeField) – Deleted
- name (CharField) – name of the video
- description (TextField) – description of the video
- author (ForeignKey to
User
) – author of the video - language (CharField) – language of the video
- duplicated_from (ForeignKey to
Video
) – original video this one was duplicated from
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
audiotracks
¶ Model field: video, accesses the M2M
AudioTrack
model.
Model field: author, accesses the
User
model.
Model field: author
-
description
¶ Model field: description
-
duplicated_from_id
¶ Model field: duplicate from
-
get_language_display
(*, field=<django.db.models.fields.CharField: language>)¶ Autogenerated: Shows the label of the
language
-
id
¶ Model field: ID
-
language
¶ Model field: language
-
name
¶ Model field: name
-
playlists_links
¶ Model field: video, accesses the M2M
PlaylistVideo
model.
-
subtitletracks
¶ Model field: video, accesses the M2M
SubtitleTrack
model.
marsha.core.views module¶
Views of the core
app of the Marsha project.
Module contents¶
The core
app of the Marsha project.