diff --git a/reValuate/db.sqlite3 b/reValuate/db.sqlite3 index 2fe22774..86f3ec46 100644 Binary files a/reValuate/db.sqlite3 and b/reValuate/db.sqlite3 differ diff --git a/reValuate/home/__pycache__/views.cpython-38.pyc b/reValuate/home/__pycache__/views.cpython-38.pyc index 60cde62b..ff7f1565 100644 Binary files a/reValuate/home/__pycache__/views.cpython-38.pyc and b/reValuate/home/__pycache__/views.cpython-38.pyc differ diff --git a/reValuate/home/static/home/css/main.css b/reValuate/home/static/home/css/main.css index a1ca0b29..a19ffb2a 100644 --- a/reValuate/home/static/home/css/main.css +++ b/reValuate/home/static/home/css/main.css @@ -3504,3 +3504,5 @@ input, select, textarea { } } + + \ No newline at end of file diff --git a/reValuate/home/views.py b/reValuate/home/views.py index 0558d1d8..2dbc013e 100644 --- a/reValuate/home/views.py +++ b/reValuate/home/views.py @@ -1,10 +1,26 @@ from django.shortcuts import render import os.path +from users.models import Balance def homePage(request): - currencyTotal = open(os.path.dirname(__file__) + "/../currency.txt","r") - currencyTotal = currencyTotal.readline() - context = { - "currencyTotal" : currencyTotal - } - return render(request, "home.html", context) + iter_var = 0 + all_balance = [] + + try: + a = Balance.objects.all() + for user in a: + all_balance.append(user.balanceValue) + print(f"{all_balance}") + context = { + "currencyTotal":sum(all_balance) + } + return render(request, "home.html", context) + + + except Exception as e: + + context = { + "currencyTotal":e + } + return render(request, "home.html", context) + \ No newline at end of file diff --git a/reValuate/media/images/1/0RhOu.png b/reValuate/media/images/1/0RhOu.png deleted file mode 100644 index 6866b225..00000000 Binary files a/reValuate/media/images/1/0RhOu.png and /dev/null differ diff --git a/reValuate/media/images/1/1604-lubuntu-default-wallpaper-neutral.png b/reValuate/media/images/1/1604-lubuntu-default-wallpaper-neutral.png deleted file mode 100644 index 9d2029e8..00000000 Binary files a/reValuate/media/images/1/1604-lubuntu-default-wallpaper-neutral.png and /dev/null differ diff --git a/reValuate/media/images/1/Firefox_wallpaper.png b/reValuate/media/images/1/Firefox_wallpaper.png deleted file mode 100644 index e2f23fcc..00000000 Binary files a/reValuate/media/images/1/Firefox_wallpaper.png and /dev/null differ diff --git a/reValuate/media/images/1/pexels-mali-maeder-802221.jpg b/reValuate/media/images/1/pexels-mali-maeder-802221.jpg new file mode 100644 index 00000000..473acc3f Binary files /dev/null and b/reValuate/media/images/1/pexels-mali-maeder-802221.jpg differ diff --git a/reValuate/media/images/1/pexels-mali-maeder-802221_XdYP9Ry.jpg b/reValuate/media/images/1/pexels-mali-maeder-802221_XdYP9Ry.jpg new file mode 100644 index 00000000..473acc3f Binary files /dev/null and b/reValuate/media/images/1/pexels-mali-maeder-802221_XdYP9Ry.jpg differ diff --git a/reValuate/media/images/2/Firefox_wallpaper.png b/reValuate/media/images/2/Firefox_wallpaper.png deleted file mode 100644 index e2f23fcc..00000000 Binary files a/reValuate/media/images/2/Firefox_wallpaper.png and /dev/null differ diff --git a/reValuate/media/images/2/Firefox_wallpaper_kUUWnUG.png b/reValuate/media/images/2/Firefox_wallpaper_kUUWnUG.png deleted file mode 100644 index e2f23fcc..00000000 Binary files a/reValuate/media/images/2/Firefox_wallpaper_kUUWnUG.png and /dev/null differ diff --git a/reValuate/media/images/3/0RhOu.png b/reValuate/media/images/3/0RhOu.png deleted file mode 100644 index 6866b225..00000000 Binary files a/reValuate/media/images/3/0RhOu.png and /dev/null differ diff --git a/reValuate/media/images/3/Firefox_wallpaper.png b/reValuate/media/images/3/Firefox_wallpaper.png deleted file mode 100644 index e2f23fcc..00000000 Binary files a/reValuate/media/images/3/Firefox_wallpaper.png and /dev/null differ diff --git a/reValuate/media/images/3/Firefox_wallpaper_VawhPCu.png b/reValuate/media/images/3/Firefox_wallpaper_VawhPCu.png deleted file mode 100644 index e2f23fcc..00000000 Binary files a/reValuate/media/images/3/Firefox_wallpaper_VawhPCu.png and /dev/null differ diff --git a/reValuate/media/images/3/Firefox_wallpaper_rfeAtQ2.png b/reValuate/media/images/3/Firefox_wallpaper_rfeAtQ2.png deleted file mode 100644 index e2f23fcc..00000000 Binary files a/reValuate/media/images/3/Firefox_wallpaper_rfeAtQ2.png and /dev/null differ diff --git a/reValuate/media/images/3/Firefox_wallpaper_whgMjoy.png b/reValuate/media/images/3/Firefox_wallpaper_whgMjoy.png deleted file mode 100644 index e2f23fcc..00000000 Binary files a/reValuate/media/images/3/Firefox_wallpaper_whgMjoy.png and /dev/null differ diff --git a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video.mp4 b/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video.mp4 deleted file mode 100644 index 1eabf40a..00000000 Binary files a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video.mp4 and /dev/null differ diff --git a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_7x9g4Ll.mp4 b/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_7x9g4Ll.mp4 deleted file mode 100644 index 1eabf40a..00000000 Binary files a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_7x9g4Ll.mp4 and /dev/null differ diff --git a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_F54umwM.mp4 b/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_F54umwM.mp4 deleted file mode 100644 index 1eabf40a..00000000 Binary files a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_F54umwM.mp4 and /dev/null differ diff --git a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_WgdBT3K.mp4 b/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_WgdBT3K.mp4 deleted file mode 100644 index 1eabf40a..00000000 Binary files a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_WgdBT3K.mp4 and /dev/null differ diff --git a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_kFN2Ziy.mp4 b/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_kFN2Ziy.mp4 deleted file mode 100644 index 1eabf40a..00000000 Binary files a/reValuate/media/videos/1/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_kFN2Ziy.mp4 and /dev/null differ diff --git a/reValuate/media/videos/2/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video.mp4 b/reValuate/media/videos/2/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video.mp4 deleted file mode 100644 index 1eabf40a..00000000 Binary files a/reValuate/media/videos/2/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video.mp4 and /dev/null differ diff --git a/reValuate/media/videos/2/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_BzkKMHx.mp4 b/reValuate/media/videos/2/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_BzkKMHx.mp4 deleted file mode 100644 index 1eabf40a..00000000 Binary files a/reValuate/media/videos/2/RiceGum_-_Nae_Nae_Nigga_Official_FULL_Music_Video_BzkKMHx.mp4 and /dev/null differ diff --git a/reValuate/micro b/reValuate/micro new file mode 100644 index 00000000..183d559e --- /dev/null +++ b/reValuate/micro @@ -0,0 +1,27 @@ +[?1049h[>4;2m[?1h=[?2004h[?1004h[?12h[?12l[?25lE325: ATTENTION +Found a swap file by the name "~/github/reValuate/.git/.COMMIT_EDITMSG.swp" +owned by: gang420 dated: Thu Mar 11 03:38:41 2021 +file name: ~gang420/github/reValuate/.git/COMMIT_EDITMSG +modified: YES +user name: gang420 host name: CatShip +process ID: 22317 +While opening file "/home/gang420/github/reValuate/.git/COMMIT_EDITMSG" +dated: Thu Mar 11 03:38:56 2021 + NEWER than swap file! + +(1) Another program may be editing the same file. If this is the case, + be careful not to end up with two different instances of the same + file when making changes. Quit, or continue with caution. +(2) An edit session for this file crashed. + If this is the case, use ":recover" or "vim -r /home/gang420/github/reValuate/. +git/COMMIT_EDITMSG" + to recover the changes (see ":help recovery"). + If you did this already, delete the swap file "/home/gang420/github/reValuate/. +git/.COMMIT_EDITMSG.swp" + to avoid this message. + +Swap file "~/github/reValuate/.git/.COMMIT_EDITMSG.swp" already exists! +-- More --[?25h[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:  +Interrupt: Press ENTER or type command to continue[?25l~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 0,0-1All[?25h[?1004l[?2004l[?1l>[>4;m[?1049lVim: Caught deadly signal HUP +Vim: Finished. + \ No newline at end of file diff --git a/reValuate/templates/addBalance.html b/reValuate/templates/addBalance.html index e8f89068..407d5814 100644 --- a/reValuate/templates/addBalance.html +++ b/reValuate/templates/addBalance.html @@ -3,26 +3,22 @@ {% block title %} Update Balance {% endblock %} - -{% if user.is_superuser %} - - {% block content %}
-{% if message is None %} -

Hello, {{ user.username }} !

-{% else %} -

{{ message }}

-{% endif %} - -
- {% csrf_token %} -
- - -
- {% endblock %} + +{% if request.user.is_superuser %} + +

Hello, {{ user.username }} !

+ +
+ {% csrf_token %} +
+ + +
+ + {% else %} @@ -30,4 +26,4 @@
{% endif %} - +{% endblock %} diff --git a/reValuate/templates/adminView.html b/reValuate/templates/adminView.html new file mode 100644 index 00000000..f3995a3e --- /dev/null +++ b/reValuate/templates/adminView.html @@ -0,0 +1,77 @@ +{% extends 'base.html' %} + +{% block optionalParams %} + +{% endblock %} + + +{% block content %} +
+ + {% if image %} +
+ {% csrf_token %} + +
+ +

+
+
+ + + + + + + {% else %} + +

Congratulations, there is no work left

+
+

🎉

+

🥳

+

🎉

+
+ {% endif %} + + +
+ {% endblock %} + + + diff --git a/reValuate/templates/showAllImage.html b/reValuate/templates/showAllImage.html index 02d03fae..ba75053e 100644 --- a/reValuate/templates/showAllImage.html +++ b/reValuate/templates/showAllImage.html @@ -5,7 +5,7 @@ {% block content %} {% if user.is_authenticated %} Hi {{ user.username }}!
- + {% for image in images %} {% endfor %} diff --git a/reValuate/upload/__pycache__/models.cpython-38.pyc b/reValuate/upload/__pycache__/models.cpython-38.pyc index 097daaa6..ddcc9d54 100644 Binary files a/reValuate/upload/__pycache__/models.cpython-38.pyc and b/reValuate/upload/__pycache__/models.cpython-38.pyc differ diff --git a/reValuate/upload/__pycache__/views.cpython-38.pyc b/reValuate/upload/__pycache__/views.cpython-38.pyc index 8f319669..8853e886 100644 Binary files a/reValuate/upload/__pycache__/views.cpython-38.pyc and b/reValuate/upload/__pycache__/views.cpython-38.pyc differ diff --git a/reValuate/upload/migrations/0004_auto_20210311_1702.py b/reValuate/upload/migrations/0004_auto_20210311_1702.py new file mode 100644 index 00000000..45fbc5b2 --- /dev/null +++ b/reValuate/upload/migrations/0004_auto_20210311_1702.py @@ -0,0 +1,27 @@ +# Generated by Django 3.1.6 on 2021-03-11 15:02 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('upload', '0003_delete_balance'), + ] + + operations = [ + migrations.AlterModelOptions( + name='image', + options={'verbose_name': 'image', 'verbose_name_plural': 'images'}, + ), + migrations.AddField( + model_name='image', + name='tokenized', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='videos', + name='tokenized', + field=models.BooleanField(default=False), + ), + ] diff --git a/reValuate/upload/migrations/0005_auto_20210311_1833.py b/reValuate/upload/migrations/0005_auto_20210311_1833.py new file mode 100644 index 00000000..c291a0d2 --- /dev/null +++ b/reValuate/upload/migrations/0005_auto_20210311_1833.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.6 on 2021-03-11 16:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('upload', '0004_auto_20210311_1702'), + ] + + operations = [ + migrations.AddField( + model_name='image', + name='reason', + field=models.CharField(default=None, max_length=120), + ), + migrations.AddField( + model_name='videos', + name='reason', + field=models.CharField(default=None, max_length=120), + ), + ] diff --git a/reValuate/upload/migrations/0006_auto_20210311_1833.py b/reValuate/upload/migrations/0006_auto_20210311_1833.py new file mode 100644 index 00000000..3ffe5026 --- /dev/null +++ b/reValuate/upload/migrations/0006_auto_20210311_1833.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.6 on 2021-03-11 16:33 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('upload', '0005_auto_20210311_1833'), + ] + + operations = [ + migrations.AlterField( + model_name='image', + name='reason', + field=models.CharField(blank=True, default=None, max_length=120, null=True), + ), + migrations.AlterField( + model_name='videos', + name='reason', + field=models.CharField(blank=True, default=None, max_length=120, null=True), + ), + ] diff --git a/reValuate/upload/migrations/0007_auto_20210311_1834.py b/reValuate/upload/migrations/0007_auto_20210311_1834.py new file mode 100644 index 00000000..60811e04 --- /dev/null +++ b/reValuate/upload/migrations/0007_auto_20210311_1834.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.6 on 2021-03-11 16:34 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('upload', '0006_auto_20210311_1833'), + ] + + operations = [ + migrations.AlterField( + model_name='image', + name='reason', + field=models.CharField(blank=True, max_length=120, null=True), + ), + migrations.AlterField( + model_name='videos', + name='reason', + field=models.CharField(blank=True, max_length=120, null=True), + ), + ] diff --git a/reValuate/upload/migrations/0008_auto_20210311_1838.py b/reValuate/upload/migrations/0008_auto_20210311_1838.py new file mode 100644 index 00000000..766dc53e --- /dev/null +++ b/reValuate/upload/migrations/0008_auto_20210311_1838.py @@ -0,0 +1,23 @@ +# Generated by Django 3.1.6 on 2021-03-11 16:38 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('upload', '0007_auto_20210311_1834'), + ] + + operations = [ + migrations.AlterField( + model_name='image', + name='reason', + field=models.CharField(max_length=120), + ), + migrations.AlterField( + model_name='videos', + name='reason', + field=models.CharField(max_length=120), + ), + ] diff --git a/reValuate/upload/migrations/0009_auto_20210311_1910.py b/reValuate/upload/migrations/0009_auto_20210311_1910.py new file mode 100644 index 00000000..d937e91b --- /dev/null +++ b/reValuate/upload/migrations/0009_auto_20210311_1910.py @@ -0,0 +1,26 @@ +# Generated by Django 3.1.6 on 2021-03-11 17:10 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('upload', '0008_auto_20210311_1838'), + ] + + operations = [ + migrations.AlterField( + model_name='image', + name='user', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='videos', + name='user', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/reValuate/upload/migrations/__pycache__/0004_auto_20210311_1702.cpython-38.pyc b/reValuate/upload/migrations/__pycache__/0004_auto_20210311_1702.cpython-38.pyc new file mode 100644 index 00000000..6c4d7aab Binary files /dev/null and b/reValuate/upload/migrations/__pycache__/0004_auto_20210311_1702.cpython-38.pyc differ diff --git a/reValuate/upload/migrations/__pycache__/0005_auto_20210311_1833.cpython-38.pyc b/reValuate/upload/migrations/__pycache__/0005_auto_20210311_1833.cpython-38.pyc new file mode 100644 index 00000000..64d90132 Binary files /dev/null and b/reValuate/upload/migrations/__pycache__/0005_auto_20210311_1833.cpython-38.pyc differ diff --git a/reValuate/upload/migrations/__pycache__/0006_auto_20210311_1833.cpython-38.pyc b/reValuate/upload/migrations/__pycache__/0006_auto_20210311_1833.cpython-38.pyc new file mode 100644 index 00000000..f311807c Binary files /dev/null and b/reValuate/upload/migrations/__pycache__/0006_auto_20210311_1833.cpython-38.pyc differ diff --git a/reValuate/upload/migrations/__pycache__/0007_auto_20210311_1834.cpython-38.pyc b/reValuate/upload/migrations/__pycache__/0007_auto_20210311_1834.cpython-38.pyc new file mode 100644 index 00000000..fe8559bd Binary files /dev/null and b/reValuate/upload/migrations/__pycache__/0007_auto_20210311_1834.cpython-38.pyc differ diff --git a/reValuate/upload/migrations/__pycache__/0008_auto_20210311_1838.cpython-38.pyc b/reValuate/upload/migrations/__pycache__/0008_auto_20210311_1838.cpython-38.pyc new file mode 100644 index 00000000..cb004be2 Binary files /dev/null and b/reValuate/upload/migrations/__pycache__/0008_auto_20210311_1838.cpython-38.pyc differ diff --git a/reValuate/upload/migrations/__pycache__/0009_auto_20210311_1910.cpython-38.pyc b/reValuate/upload/migrations/__pycache__/0009_auto_20210311_1910.cpython-38.pyc new file mode 100644 index 00000000..91bdf45a Binary files /dev/null and b/reValuate/upload/migrations/__pycache__/0009_auto_20210311_1910.cpython-38.pyc differ diff --git a/reValuate/upload/models.py b/reValuate/upload/models.py index ac96bc7b..cef10f02 100644 --- a/reValuate/upload/models.py +++ b/reValuate/upload/models.py @@ -18,21 +18,23 @@ def videosPath(instance,filename): return f"videos/{instance.user.id}/{filename}" class Image(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE, blank=True, null=True) - # title = models.CharField(max_length=200) + user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True) image = models.ImageField(upload_to=imagesPath,validators=[imageValidate]) - - # def __str__(self): - # return self.title + tokenized = models.BooleanField(default=False) + reason = models.CharField(max_length=120) + + class Meta: + verbose_name = 'image' + verbose_name_plural = 'images' class Videos(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE, blank=True, null=True) - # title = models.CharField(max_length=100) + user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True) video = models.FileField(upload_to=videosPath, validators=[videoValidate]) + tokenized = models.BooleanField(default=False) + reason = models.CharField(max_length=120) + + class Meta: verbose_name = 'video' verbose_name_plural = 'videos' - - # def __str__(self): - # return self.title diff --git a/reValuate/upload/views.py b/reValuate/upload/views.py index 562fc081..ce44f357 100644 --- a/reValuate/upload/views.py +++ b/reValuate/upload/views.py @@ -54,11 +54,13 @@ def videoUpload(request): form = VideoForm() return render(request, 'uploadVideo.html', {'form': form}) + def viewMedia(request): path = settings.MEDIA_ROOT img_list = os.listdir(path + f"images/{request.user.id}/") context = { - "images": img_list, - "id":request.user.id, + "images": img_list, + "id":request.user.id, } return render (request, 'showAllImage.html', context) + diff --git a/reValuate/users/__pycache__/models.cpython-38.pyc b/reValuate/users/__pycache__/models.cpython-38.pyc index 79b15a60..9f802eba 100644 Binary files a/reValuate/users/__pycache__/models.cpython-38.pyc and b/reValuate/users/__pycache__/models.cpython-38.pyc differ diff --git a/reValuate/users/__pycache__/views.cpython-38.pyc b/reValuate/users/__pycache__/views.cpython-38.pyc index 19da4731..f758c421 100644 Binary files a/reValuate/users/__pycache__/views.cpython-38.pyc and b/reValuate/users/__pycache__/views.cpython-38.pyc differ diff --git a/reValuate/users/adminView/css/main.css b/reValuate/users/adminView/css/main.css new file mode 100644 index 00000000..1e29b5b4 --- /dev/null +++ b/reValuate/users/adminView/css/main.css @@ -0,0 +1,89 @@ +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +.app { + position: relative; + width: 100%; + height: 100vh; + overflow: hidden; +} + +.card { + width: 300px; + height: 400px; + position: absolute; + border-radius: 10px; + position: absolute; + left: 0; + right: 0; + margin-left: auto; + margin-right: auto; + transform-origin: center; + margin-top: auto; + margin-bottom: auto; + top: 0; + bottom: 0; + cursor: -webkit-grab; + -webkit-transform-style: preserve-3d; + transform-style: preserve-3d; + -webkit-transform: perspective(800px); + transform: perspective(800px); +} +.color0 { + background-image: linear-gradient(to right, #43e97b 0%, #38f9d7 100%); +} +.color1 { + background-image: linear-gradient( + to top, + #3f51b1 0%, + #5a55ae 13%, + #7b5fac 25%, + #8f6aae 38%, + #a86aa4 50%, + #cc6b8e 62%, + #f18271 75%, + #f3a469 87%, + #f7c978 100% + ); +} + +.color2 { + background-image: linear-gradient( + to top, + #dbdcd7 0%, + #dddcd7 24%, + #e2c9cc 30%, + #e7627d 46%, + #b8235a 59%, + #801357 71%, + #3d1635 84%, + #1c1a27 100% + ); +} + +.color3 { + background-image: linear-gradient(to top, #0250c5 0%, #d43f8d 100%); +} + +.color4 { + background-image: linear-gradient(to top, #c7eafd 0%, #e8198b 100%); +} + +.text { + text-align: center; + font-family: "Montserrat", sans-serif; + font-size: 28px; + font-weight: 900; + font-style: italic; + margin-top: 50px; + color: #fff; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} diff --git a/reValuate/users/adminView/js/main.js b/reValuate/users/adminView/js/main.js new file mode 100644 index 00000000..4bd4a98d --- /dev/null +++ b/reValuate/users/adminView/js/main.js @@ -0,0 +1,343 @@ +class Card extends React.Component { + constructor(props) { + super(props); + this.state = { + active: false, + move: false, + limit: false, + mouseStartPosX: null, + mouseStartPosY: null, + mouseCurrPosX: null, + mouseCurrPosY: null, + Posx: null, + Posy: null, + k: 0.2, + restX: 0, + restY: 0, + fx: 0, + fy: 0, + ax: 0, + ay: 0, + vx: 0.0, + vy: 0.0, + mass: 0.7, + damping: 0.8 + }; + this.handleDown = this.handleDown.bind(this); + this.handleUp = this.handleUp.bind(this); + this.handleMove = this.handleMove.bind(this); + this.animate = this.animate.bind(this); + this.updateCard = this.updateCard.bind(this); + this.handleTouchStart = this.handleTouchStart.bind(this); + this.handleTouchEnd = this.handleTouchEnd.bind(this); + this.handleTouchMove = this.handleTouchMove.bind(this); + } + + componentDidMount() { + this.animate(); + } + + handleDown(e) { + this.setState({ + move: true, + active: true, + mouseStartPosX: e.clientX, + mouseStartPosY: e.clientY + }); + } + + handleTouchStart(e) { + e.persist(); + this.setState({ + move: true, + active: true, + mouseStartPosX: e.touches[0].screenX, + mouseStartPosY: e.touches[0].screenY + }); + console.log(this.state.mouseStartPosX); + } + + handleMove(e) { + if (!this.state.limit) { + if (this.state.move) { + let mouseCurrPosX = e.clientX; + let mouseCurrPosY = e.clientY; + let Posx = mouseCurrPosX - this.state.mouseStartPosX; + let Posy = mouseCurrPosY - this.state.mouseStartPosY; + let el = document.getElementById("card" + this.props.no); + let height = window.innerHeight; + let width = window.innerWidth; + let maxX = width - width * 20 / 100; + function map_range(value, low1, high1, low2, high2) { + return low2 + (high2 - low2) * (value - low1) / (high1 - low1); + } + let mouseRange = mouseCurrPosX; + if (mouseRange < width / 2) { + mouseRange = width - mouseRange; + } + let damping = map_range( + mouseRange, + width / 2, + width - width * 10 / 100, + 0.6, + 0.8 + ); + + this.setState({ + Posx, + Posy, + damping, + mouseCurrPosX, + mouseCurrPosY + }); + + if (mouseCurrPosX > width - width * 20 / 100) { + let restX, restY; + if (mouseCurrPosX > width / 2) { + restX = this.state.Posx * 5; + } else { + restX = -this.state.Posx * 5; + } + if (mouseCurrPosY > height / 2) { + restY = this.state.Posy * 5; + } else { + restY = this.state.Posy * 5; + } + let limit = true; + let move = false; + let damping = 0.06; + this.setState( + { + restX, + restY, + limit, + move, + damping + }, + () => { + setTimeout(() => { + window.cancelAnimationFrame(this.animate); + }, 10); + } + ); + } else if (mouseCurrPosX < width * 20 / 100) { + let restX, restY; + if (mouseCurrPosX > width / 2) { + restX = -this.state.Posx * 5; + } else { + restX = this.state.Posx * 5; + } + if (mouseCurrPosY > height / 2) { + restY = this.state.Posy * 5; + } else { + restY = this.state.Posy * 5; + } + let limit = true; + let move = false; + let damping = 0.06; + this.setState({ + restX, + restY, + limit, + move, + damping + }); + } + } + } + } + + handleTouchMove(e) { + e.persist(); + if (!this.state.limit) { + if (this.state.move) { + let mouseCurrPosX = e.touches[0].screenX; + let mouseCurrPosY = e.touches[0].screenY; + let Posx = mouseCurrPosX - this.state.mouseStartPosX; + let Posy = mouseCurrPosY - this.state.mouseStartPosY; + let el = document.getElementById("card" + this.props.no); + let height = window.innerHeight; + let width = window.innerWidth; + let maxX = width - width * 20 / 100; + function map_range(value, low1, high1, low2, high2) { + return low2 + (high2 - low2) * (value - low1) / (high1 - low1); + } + let mouseRange = mouseCurrPosX; + if (mouseRange < width / 2) { + mouseRange = width - mouseRange; + } + let damping = map_range( + mouseRange, + width / 2, + width - width * 10 / 100, + 0.6, + 0.8 + ); + + this.setState({ + Posx, + Posy, + damping, + mouseCurrPosX, + mouseCurrPosY + }); + + if (mouseCurrPosX > width - width * 10 / 100) { + let restX, restY; + if (mouseCurrPosX > width / 2) { + restX = this.state.Posx * 5; + } else { + restX = -this.state.Posx * 5; + } + if (mouseCurrPosY > height / 2) { + restY = this.state.Posy * 5; + } else { + restY = this.state.Posy * 5; + } + let limit = true; + let move = false; + let damping = 0.08; + this.setState( + { + restX, + restY, + limit, + move, + damping + }, + () => { + setTimeout(() => { + window.cancelAnimationFrame(this.animate); + }, 10); + } + ); + } else if (mouseCurrPosX < width * 10 / 100) { + let restX, restY; + if (mouseCurrPosX > width / 2) { + restX = -this.state.Posx * 5; + } else { + restX = this.state.Posx * 5; + } + if (mouseCurrPosY > height / 2) { + restY = this.state.Posy * 5; + } else { + restY = this.state.Posy * 5; + } + let limit = true; + let move = false; + let damping = 0.08; + this.setState({ + restX, + restY, + limit, + move, + damping + }); + } + } + } + } + + handleUp() { + this.setState({ + move: false + }); + } + + handleTouchEnd() { + this.setState({ + move: false + }); + } + + updateCard() { + if (!this.state.move) { + this.setState( + { + fx: -this.state.k * (this.state.Posx - this.state.restX), + fy: -this.state.k * (this.state.Posy - this.state.restY) + }, + () => { + this.setState( + { + ax: this.state.fx / this.state.mass, + ay: this.state.fy / this.state.mass + }, + () => { + this.setState( + { + vx: this.state.damping * (this.state.vx + this.state.ax), + vy: this.state.damping * (this.state.vy + this.state.ay) + }, + () => { + this.setState({ + Posx: this.state.Posx + this.state.vx, + Posy: this.state.Posy + this.state.vy + }); + } + ); + } + ); + } + ); + } + } + + animate() { + let el = document.getElementById("card" + this.props.no); + if ( + this.state.Posx > window.innerWidth + 400 || + this.state.Posx < -window.innerWidth - 400 + ) { + cancelAnimationFrame(this.animate); + } else { + requestAnimationFrame(this.animate); + } + if (this.state.active) { + el.style.transform = + "translate(" + + this.state.Posx + + "px" + + "," + + this.state.Posy + + "px) rotate(" + + this.state.Posx / 9 + + "deg) perspective(800px)"; + this.updateCard(); + } + } + + render() { + return ( +
+
DRAG THE CARD LEFT OR RIGHT
+
+ ); + } +} + +class App extends React.Component { + constructor(props) { + super(props); + this.state = { + data: [0, 1, 2, 3, 4] + }; + } + render() { + var box = this.state.data.map((item, i) => { + return ; + }); + return
{box}
; + } +} +ReactDOM.render(, document.getElementById("app")); diff --git a/reValuate/users/views.py b/reValuate/users/views.py index 1e330302..cb239eec 100644 --- a/reValuate/users/views.py +++ b/reValuate/users/views.py @@ -5,6 +5,7 @@ from .models import Balance from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.auth.models import User from django.contrib import messages +from upload.models import Image, Videos # need to make oauth facebook login class SignUpView(generic.CreateView): @@ -52,6 +53,7 @@ def removeBalance(request): return render(request,"getBalance.html", {"userBalance":balAdd}) else: return render(request,"removeBalance.html") + def getBalance(request): balObject = Balance.objects.filter(user=request.user.id) print(dir(balObject)) @@ -61,3 +63,21 @@ def getBalance(request): return render(request,"getBalance.html", {"userBalance":userBalance} ) +def adminView(request): + congrats = None + try: + latestPicture = Image.objects.filter(tokenized=False) + latestPicture, userId = latestPicture.values("image")[0]["image"], latestPicture.values("user_id")[0]["user_id"] + + if request.method == "POST": + if request.POST.get('Valid','True'): + imageObj = Image.objects.get(image=latestPicture, user_id=userId) + imageObj.tokenized = True + imageObj.save() + return redirect("/admin/") + else: + Image.objects.get(image=latestPicture, user_id=userId).delete() + return render(request, "adminView.html", {"image":latestPicture, "userId":userId}) + except IndexError: + return render(request, "adminView.html") + return render(request, "adminView.html") diff --git a/reValuate/website/__pycache__/settings.cpython-38.pyc b/reValuate/website/__pycache__/settings.cpython-38.pyc index 7ee65df8..d5d37b07 100644 Binary files a/reValuate/website/__pycache__/settings.cpython-38.pyc and b/reValuate/website/__pycache__/settings.cpython-38.pyc differ diff --git a/reValuate/website/__pycache__/urls.cpython-38.pyc b/reValuate/website/__pycache__/urls.cpython-38.pyc index c29d721d..7ad7a478 100644 Binary files a/reValuate/website/__pycache__/urls.cpython-38.pyc and b/reValuate/website/__pycache__/urls.cpython-38.pyc differ diff --git a/reValuate/website/__pycache__/wsgi.cpython-38.pyc b/reValuate/website/__pycache__/wsgi.cpython-38.pyc index 958214ce..2b9a52c4 100644 Binary files a/reValuate/website/__pycache__/wsgi.cpython-38.pyc and b/reValuate/website/__pycache__/wsgi.cpython-38.pyc differ diff --git a/reValuate/website/settings.py b/reValuate/website/settings.py index c11df884..da7e9914 100644 --- a/reValuate/website/settings.py +++ b/reValuate/website/settings.py @@ -13,6 +13,8 @@ https://docs.djangoproject.com/en/3.1/ref/settings/ from pathlib import Path import os + + # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -137,3 +139,4 @@ EMAIL_FILE_PATH = str(BASE_DIR.joinpath('sent_emails')) MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') +os.environ["DJANGO_ALLOW_ASYNC_UNSAFE"] = "true" \ No newline at end of file diff --git a/reValuate/website/urls.py b/reValuate/website/urls.py index a04298e9..49024dc0 100644 --- a/reValuate/website/urls.py +++ b/reValuate/website/urls.py @@ -21,10 +21,10 @@ from django.conf.urls.static import static from django.contrib.auth import views from django.views.generic.base import TemplateView from upload.views import uploadContent, imageUpload, videoUpload, viewMedia -from users.views import getBalance, addToBalance +from users.views import getBalance, addToBalance, adminView urlpatterns = [ path("", homePage, name='home'), - path('admin/', admin.site.urls), + path("users/", include('django.contrib.auth.urls')), path('users/', include('users.urls')), path("upload/", uploadContent, name="Upload"), @@ -32,7 +32,8 @@ urlpatterns = [ path("upload_video/", videoUpload, name="Video"), path("view_media/", viewMedia, name="All Media"), path("get_balance/",getBalance, name="Balance" ), - path("add_balance/", addToBalance, name="Add") + path("add_balance/", addToBalance, name="Add"), + path("admin/", adminView, name="admin") ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL,