-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add youtube preview and store youtube api data in db (#39)
* merged widget_tweak and added url preview and storage of data to db * changes done partially fix #8
- Loading branch information
Showing
8 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
learn/migrations/0033_youtuberesource_squashed_0035_auto_20181227_1729.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.11.15 on 2018-12-30 19:56 | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
replaces = [('learn', '0033_youtuberesource'), ('learn', '0034_auto_20181227_1729'), ('learn', '0035_auto_20181227_1729')] | ||
|
||
dependencies = [ | ||
('learn', '0032_auto_20181217_2102'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='YoutubeResource', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('published_at', models.CharField(max_length=100)), | ||
('title', models.CharField(max_length=50)), | ||
('description', models.TextField(max_length=10000)), | ||
('thumbnail_url', models.CharField(max_length=100)), | ||
('duration', models.CharField(max_length=10)), | ||
('view_count', models.IntegerField()), | ||
('like_count', models.IntegerField()), | ||
('dislike_count', models.IntegerField()), | ||
('comment_count', models.IntegerField()), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{% extends 'base.html' %} | ||
{% block content %} | ||
|
||
<form method="post" action="{% url 'youtubeResourcePreview' %}"> | ||
{% csrf_token %} | ||
<div class="form-group"> | ||
<label for="email">Url:</label> | ||
<input type="text" class="form-control" name="url"> | ||
<input type="submit" value="Preview" class="btn btn-primary"> | ||
</div> | ||
</form> | ||
|
||
{% if flag %} | ||
<h4>{{title}}</h4> | ||
<img src={{thumbnail_url}} height="200px" width="200px"> | ||
<form method='post' action="{% url 'youtubeResource'%}"> | ||
{% csrf_token %} | ||
<input type="submit" value="Yes" class="btn btn-success"name="next"> | ||
<input type="submit" class="btn btn-danger" value="No" name="no"> | ||
</form> | ||
{% endif %} | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters