diff --git a/currencyproj/currencyproj/__pycache__/__init__.cpython-36.pyc b/currencyproj/currencyproj/__pycache__/__init__.cpython-36.pyc index 330a35f8..1675128a 100644 Binary files a/currencyproj/currencyproj/__pycache__/__init__.cpython-36.pyc and b/currencyproj/currencyproj/__pycache__/__init__.cpython-36.pyc differ diff --git a/currencyproj/currencyproj/__pycache__/settings.cpython-36.pyc b/currencyproj/currencyproj/__pycache__/settings.cpython-36.pyc index 610df9fe..9418a96c 100644 Binary files a/currencyproj/currencyproj/__pycache__/settings.cpython-36.pyc and b/currencyproj/currencyproj/__pycache__/settings.cpython-36.pyc differ diff --git a/currencyproj/currencyproj/settings.py b/currencyproj/currencyproj/settings.py index a54205a6..9b6ca056 100644 --- a/currencyproj/currencyproj/settings.py +++ b/currencyproj/currencyproj/settings.py @@ -37,6 +37,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'home', ] MIDDLEWARE = [ diff --git a/currencyproj/currencyproj/urls.py b/currencyproj/currencyproj/urls.py index ba234304..30e1417f 100644 --- a/currencyproj/currencyproj/urls.py +++ b/currencyproj/currencyproj/urls.py @@ -15,7 +15,13 @@ Including another URLconf """ from django.contrib import admin from django.urls import path +from home.models import upload_video,upload_image +from home.views import upload_content, imageUpload, videoUpload urlpatterns = [ path('admin/', admin.site.urls), + path('upload/',upload_content, name="upload"), + path('upload_video/',videoUpload,name='upload_video'), + path('upload_image/',imageUpload,name='upload_image'), + ] diff --git a/currencyproj/db.sqlite3 b/currencyproj/db.sqlite3 new file mode 100644 index 00000000..07ab0ea0 Binary files /dev/null and b/currencyproj/db.sqlite3 differ diff --git a/currencyproj/home/admin.py b/currencyproj/home/admin.py index 8c38f3f3..cc1da641 100644 --- a/currencyproj/home/admin.py +++ b/currencyproj/home/admin.py @@ -1,3 +1,5 @@ from django.contrib import admin +from .models import upload_image, upload_video -# Register your models here. +admin.site.register(upload_image) +admin.site.register(upload_video) diff --git a/currencyproj/home/migrations/0001_initial.py b/currencyproj/home/migrations/0001_initial.py new file mode 100644 index 00000000..70f80d6e --- /dev/null +++ b/currencyproj/home/migrations/0001_initial.py @@ -0,0 +1,22 @@ +# Generated by Django 3.1.6 on 2021-02-05 00:24 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='upload', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image', models.FileField(upload_to='images/')), + ('video', models.FileField(upload_to='videos/')), + ], + ), + ] diff --git a/currencyproj/home/migrations/0002_auto_20210205_0037.py b/currencyproj/home/migrations/0002_auto_20210205_0037.py new file mode 100644 index 00000000..08f2c0b4 --- /dev/null +++ b/currencyproj/home/migrations/0002_auto_20210205_0037.py @@ -0,0 +1,30 @@ +# Generated by Django 3.1.6 on 2021-02-05 00:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('home', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='upload_image', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('image', models.FileField(upload_to='images/')), + ], + ), + migrations.CreateModel( + name='upload_video', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('video', models.FileField(upload_to='videos/')), + ], + ), + migrations.DeleteModel( + name='upload', + ), + ] diff --git a/currencyproj/home/models.py b/currencyproj/home/models.py index 4c0f90cf..e1ac3f69 100644 --- a/currencyproj/home/models.py +++ b/currencyproj/home/models.py @@ -1,6 +1,8 @@ from django.db import models -class Ticker(models.Model): - f = open("../currency.txt","r") - a = f.readline() - print(a) +class upload_image(models.Model): + # check for file extensions + image = models.FileField(upload_to="images/") + +class upload_video(models.Model): + video = models.FileField(upload_to="videos/") diff --git a/currencyproj/home/templates/index.html b/currencyproj/home/templates/index.html new file mode 100644 index 00000000..f5e1312e --- /dev/null +++ b/currencyproj/home/templates/index.html @@ -0,0 +1,20 @@ + + + + + + + + +
{% csrf_token %} + + + + + +
+ + diff --git a/currencyproj/home/templates/uploadImage.html b/currencyproj/home/templates/uploadImage.html new file mode 100644 index 00000000..3015a042 --- /dev/null +++ b/currencyproj/home/templates/uploadImage.html @@ -0,0 +1,10 @@ + + + + + test + + +

test 1

+ + diff --git a/currencyproj/home/templates/uploadVideo.html b/currencyproj/home/templates/uploadVideo.html new file mode 100644 index 00000000..aef62935 --- /dev/null +++ b/currencyproj/home/templates/uploadVideo.html @@ -0,0 +1,10 @@ + + + + + test2 + + +

test2

+ + diff --git a/currencyproj/home/views.py b/currencyproj/home/views.py index 91ea44a2..0b119d96 100644 --- a/currencyproj/home/views.py +++ b/currencyproj/home/views.py @@ -1,3 +1,40 @@ -from django.shortcuts import render +from django.shortcuts import render, redirect -# Create your views here. +from .models import upload_video,upload_image + +def imageUpload(request): + if request.method == "GET": + return render(request, "uploadImage.html") + elif request.method == "POST": + image = request.POST["image"] + # add the id of the user, after you add in users + return upload_image(image) + else: + return + +def videoUpload(request): + if request.method == "GET": + return render(request, "uploadVideo.html") + elif request.method == "POST": + video = request.POST["video"] + # add the id of the user, after you add in users + return upload_video(video) + else: + return + + + +def upload_content(request): + if request.method == "GET": + return render(request, "index.html") + elif request.method == "POST": + choice = request.POST["choices"] + if choice == "image": + return redirect("/upload_image/") + elif choice == "video": + return redirect("/upload_video/") + else: + return + else: + return +# in conclusion - im genious, good job boyan lmao diff --git a/currencyproj/images/Screenshot_at_2021-01-19_03-15-00.png b/currencyproj/images/Screenshot_at_2021-01-19_03-15-00.png new file mode 100644 index 00000000..6d58ac0b Binary files /dev/null and b/currencyproj/images/Screenshot_at_2021-01-19_03-15-00.png differ diff --git a/currencyproj/images/Screenshot_at_2021-01-19_03-15-00_lgZaOpf.png b/currencyproj/images/Screenshot_at_2021-01-19_03-15-00_lgZaOpf.png new file mode 100644 index 00000000..6d58ac0b Binary files /dev/null and b/currencyproj/images/Screenshot_at_2021-01-19_03-15-00_lgZaOpf.png differ diff --git a/currencyproj/videos/Screenshot_at_2021-01-19_03-15-00.png b/currencyproj/videos/Screenshot_at_2021-01-19_03-15-00.png new file mode 100644 index 00000000..6d58ac0b Binary files /dev/null and b/currencyproj/videos/Screenshot_at_2021-01-19_03-15-00.png differ diff --git a/currencyproj/videos/Screenshot_at_2021-01-19_03-15-00_Q5jr6vG.png b/currencyproj/videos/Screenshot_at_2021-01-19_03-15-00_Q5jr6vG.png new file mode 100644 index 00000000..6d58ac0b Binary files /dev/null and b/currencyproj/videos/Screenshot_at_2021-01-19_03-15-00_Q5jr6vG.png differ