Skip to content

Commit

Permalink
Notion video title (#2409)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulinenik authored Sep 12, 2024
1 parent 5918de5 commit 4007950
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/apps/notion/admin/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


class NotionVideoForm(forms.ModelForm):
title = forms.CharField(label=_("Title"), widget=forms.Textarea(), required=False)
youtube = forms.CharField(label=_("Youtube"), required=True, help_text=_("Paste it from the address bar"))
rutube = forms.CharField(label=_("RuTube"), required=False, help_text=_("Paste it from the address bar"))

Expand All @@ -19,7 +20,7 @@ class NotionVideoForm(forms.ModelForm):

class Meta:
model = Video
fields = ("youtube_id", "rutube_id", "rutube_access_key", "youtube", "rutube")
fields = ("title", "youtube_id", "rutube_id", "rutube_access_key", "youtube", "rutube")

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -56,6 +57,7 @@ class NotionVideoAdmin(ModelAdmin):

list_display = [
"id",
"title",
"youtube",
"rutube",
]
Expand Down
17 changes: 17 additions & 0 deletions src/apps/notion/migrations/0013_video_title.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.16 on 2024-09-12 14:39

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("notion", "0012_video_rutube_access_key_alter_video_rutube_id_and_more"),
]

operations = [
migrations.AddField(
model_name="video",
name="title",
field=models.CharField(blank=True, max_length=256, null=True, verbose_name="Title"),
),
]
1 change: 1 addition & 0 deletions src/apps/notion/models/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class Video(TimestampedModel):
"""Video mapping for multiple videohostings"""

title = models.CharField(_("Title"), max_length=256, blank=True, null=True)
youtube_id = models.CharField(max_length=256, unique=True, db_index=True)
rutube_id = models.CharField(max_length=256, blank=True, null=True, db_index=True)
rutube_access_key = models.CharField(max_length=256, blank=True, null=True)
Expand Down
8 changes: 6 additions & 2 deletions src/locale/ru/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,15 @@ msgstr "Файлы"
msgid "Paste it from the address bar"
msgstr "Скопируйте адрес из строки браузера"

#: apps/notion/models/video.py:13
#: apps/notion/models/video.py:9
msgid "Title"
msgstr "Название"

#: apps/notion/models/video.py:15
msgid "Notion video"
msgstr "Видео"

#: apps/notion/models/video.py:14
#: apps/notion/models/video.py:16
msgid "Notion videos"
msgstr "Видео"

Expand Down

0 comments on commit 4007950

Please sign in to comment.