diff --git a/topics/templates/resources/list.html b/topics/templates/resources/list.html
index 8815e1e..b44857c 100644
--- a/topics/templates/resources/list.html
+++ b/topics/templates/resources/list.html
@@ -14,7 +14,7 @@
diff --git a/youtube_video/forms.py b/youtube_video/forms.py
index 68d8e2b..9747126 100644
--- a/youtube_video/forms.py
+++ b/youtube_video/forms.py
@@ -63,8 +63,8 @@ class YTVideoForm(forms.ModelForm):
def clean_url(self):
url = self.cleaned_data.get('url', '')
- if not 'youtube' in url or not 'embed' in url:
- self._errors['url'] = [_('Invalid URL. It should be an embed YouTube link.')]
+ if not 'youtube' in url:
+ self._errors['url'] = [_('Invalid URL. It should be an YouTube link.')]
return ValueError
diff --git a/youtube_video/models.py b/youtube_video/models.py
index 307f0bc..a2bc60c 100644
--- a/youtube_video/models.py
+++ b/youtube_video/models.py
@@ -27,3 +27,13 @@ class YTVideo(Resource):
def delete_message(self):
return _('Are you sure you want delete the YouTube Video')
+
+ def get_embed_url(self):
+ if not "embed" in self.url:
+ parts = self.url.split("=")
+
+ if parts[1]:
+ return "https://www.youtube.com/embed/" + parts[1]
+
+ return self.url
+
diff --git a/youtube_video/templates/youtube/view.html b/youtube_video/templates/youtube/view.html
index c21ba2c..66aa42e 100644
--- a/youtube_video/templates/youtube/view.html
+++ b/youtube_video/templates/youtube/view.html
@@ -50,7 +50,7 @@
-
+
diff --git a/youtube_video/templates/youtube/window_view.html b/youtube_video/templates/youtube/window_view.html
index 9170bc7..73bf728 100644
--- a/youtube_video/templates/youtube/window_view.html
+++ b/youtube_video/templates/youtube/window_view.html
@@ -23,7 +23,7 @@
-
+