Skip to content

Commit

Permalink
✨(back) manage license on video resource
Browse files Browse the repository at this point in the history
An instructor wants to choose a license on a video. All Creative commons
licenses are supported. "All right reserved" license is also supported.
  • Loading branch information
lunika committed Jul 28, 2022
1 parent bc4df4f commit 41c41fe
Show file tree
Hide file tree
Showing 13 changed files with 143 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ the common application contexts (grommet, intl, react-router,
react-query, react-hot-toast, breadcrumb, styled-components)
- Add a link to generate an ics file on the scheduled page
- Manage tags on video resource
- Manage license on video resource

### Changed

Expand Down
3 changes: 2 additions & 1 deletion src/backend/marsha/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ class VideoAdmin(BaseFileAdmin):
"join_mode",
"is_public",
"tags",
"license",
)
list_display = BaseFileAdmin.list_display + (
"starting_at",
Expand All @@ -292,7 +293,7 @@ class VideoAdmin(BaseFileAdmin):
"live_type",
"recording_slices",
"live_info",
"join_mode"
"join_mode",
)
inlines = [AudioTrackInline, TimedTextTrackInline, SignTrackInline]
verbose_name = _("Video")
Expand Down
22 changes: 22 additions & 0 deletions src/backend/marsha/core/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,25 @@
RENATER_FER_SAML = "renater_fer_saml"

VIDEO_ATTENDANCE_KEY_CACHE = "attendances:video:"

# Licenses

CC_BY = "CC_BY"
CC_BY_SA = "CC_BY-SA"
CC_BY_NC = "CC_BY-NC"
CC_BY_NC_SA = "CC_BY-NC-SA"
CC_BY_ND = "CC_BY-ND"
CC_BY_NC_ND = "CC_BY-NC-ND"
CC0 = "CC0"
NO_CC = "NO_CC"

LICENCES_CHOICES = (
(CC_BY, _("Creative Common By Attribution")),
(CC_BY_SA, _("Creative Common By Attribution Share Alike")),
(CC_BY_NC, _("Creative Common By Attribution Non Commercial")),
(CC_BY_NC_SA, _("Creative Common By Attribution Non Commercial Share Alike")),
(CC_BY_ND, _("Creative Common By Attribution No Derivates")),
(CC_BY_NC_ND, _("Creative Common By Attribution Non Commercial No Derivates")),
(CC0, _("Public Domain Dedication ")),
(NO_CC, _("All rights reserved")),
)
27 changes: 27 additions & 0 deletions src/backend/marsha/core/migrations/0053_video_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,31 @@ class Migration(migrations.Migration):
size=None,
),
),
migrations.AddField(
model_name="video",
name="license",
field=models.CharField(
blank=True,
choices=[
("CC_BY", "Creative Common By Attribution"),
("CC_BY-SA", "Creative Common By Attribution Share Alike"),
("CC_BY-NC", "Creative Common By Attribution Non Commercial"),
(
"CC_BY-NC-SA",
"Creative Common By Attribution Non Commercial Share Alike",
),
("CC_BY-ND", "Creative Common By Attribution No Derivates"),
(
"CC_BY-NC-ND",
"Creative Common By Attribution Non Commercial No Derivates",
),
("CC0", "Public Domain Dedication "),
("NO_CC", "All rights reserved"),
],
help_text="License for this video",
max_length=20,
null=True,
verbose_name="licenses",
),
),
]
9 changes: 9 additions & 0 deletions src/backend/marsha/core/models/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
HARVESTED,
IDLE,
JOIN_MODE_CHOICES,
LICENCES_CHOICES,
LIVE_CHOICES,
LIVE_TYPE_CHOICES,
PENDING,
Expand Down Expand Up @@ -155,6 +156,14 @@ class Video(BaseFile):
default=list,
help_text=_("video tags"),
)
license = models.CharField(
max_length=20,
verbose_name=_("licenses"),
help_text=_("License for this video"),
choices=LICENCES_CHOICES,
null=True,
blank=True,
)

class Meta:
"""Options for the ``Video`` model."""
Expand Down
1 change: 1 addition & 0 deletions src/backend/marsha/core/serializers/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ class Meta: # noqa
"xmpp",
"shared_live_medias",
"tags",
"license",
)
read_only_fields = (
"active_shared_live_media",
Expand Down
Loading

0 comments on commit 41c41fe

Please sign in to comment.