yeeeee
@ -48,7 +48,7 @@ body{
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
a.navlink {
|
||||
a.nav-link {
|
||||
color: white;
|
||||
font-size: 30px;
|
||||
transition: 0.6s;
|
||||
@ -110,3 +110,18 @@ a.inverted:hover {
|
||||
-webkit-animation-name: slideIn;
|
||||
animation-name: slideIn;
|
||||
}
|
||||
|
||||
.Buttons {
|
||||
background-color: #ddd;
|
||||
border: none;
|
||||
color: black;
|
||||
padding: 16px 32px;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
margin: 4px 2px;
|
||||
transition: 0.3s;
|
||||
}
|
||||
.Buttons:hover {
|
||||
background-color: #28a745;
|
||||
color: white;
|
||||
}
|
BIN
reValuate/media/images/1/1259275_2suglSQ.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_7VlunMx.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_JIYdAii.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_NTiPDfS.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_Nk803p0.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_Rz4qGuD.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_UJPt8Ua.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_XQ1XIbH.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_Zo970JR.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_cvdGDuy.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_hrCQ5Ah.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_qRVifnU.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_qrFggbS.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_tc0rZT9.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/1259275_uN0OFOl.jpg
Normal file
After Width: | Height: | Size: 2.7 MiB |
BIN
reValuate/media/images/1/791.jpg
Normal file
After Width: | Height: | Size: 119 KiB |
BIN
reValuate/media/images/1/Screenshot_from_2021-02-19_13-35-55.png
Normal file
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 44 KiB |
BIN
reValuate/media/images/2/wp2058634-3840x1080-wallpapers.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
@ -47,15 +47,20 @@
|
||||
{% if image %}
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
|
||||
<p style="text-align: center;">Качено от: <br><p style="border:2px; border-color: #4CAF50; border-style: dashed; text-align: center;">{{username}}</p></p><br><br>
|
||||
|
||||
<div class="choice">
|
||||
<img src="/media/{{ image }}" width="500" width="500" >
|
||||
<img src="/media/{{ image }}" width="500" width="500" ><br>
|
||||
|
||||
</div><br>
|
||||
<p style="text-shadow: 0 0 2px #28a745; float: left;">{{time}} <p style="text-shadow: 0 0 2px #28a745; float: right;">{{date}}</p></p>
|
||||
</div>
|
||||
|
||||
<div class="choiceButtons">
|
||||
|
||||
<input name="isValid" type="submit" value="Valid">
|
||||
<input name="isValid" type="submit" value="Invalid">
|
||||
|
||||
|
||||
<input name="isValid" type="submit" value="Valid" class="Buttons">Валидна</input>
|
||||
<input name="isValid" type="submit" value="Invalid" class="Buttons">
|
||||
</form>
|
||||
|
||||
|
||||
|
@ -31,6 +31,13 @@
|
||||
<a class="nav-link" href="/upload/">Качи</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
<li class="nav-item d-none d-md-block" >
|
||||
|
||||
{% if user.is_superuser %}
|
||||
<a class="nav-link" href="/admin/">Админ</a>
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item dropdown ">
|
||||
|
@ -23,13 +23,24 @@
|
||||
<body>
|
||||
<div class="navview">
|
||||
<nav class="navbar navbar-expand-lg bg-success">
|
||||
<a style="color: white; font-size: 200%;" class="navbar-brand mb-0 h1" href="/"> reValuate </a>
|
||||
<a style="color: white; font-size: 200%;" class="navbar-brand mb-0 h1" href="/"> reValuate | </a>
|
||||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item d-none d-md-block" >
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
<a class="nav-link" href="/upload/">Качи</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
</li>
|
||||
<li class="nav-item d-none d-md-block" >
|
||||
|
||||
{% if user.is_superuser %}
|
||||
<a class="nav-link" href="/admin/">Админ</a>
|
||||
{% endif %}
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
<ul class="navbar-nav ml-auto">
|
||||
<li class="nav-item dropdown ">
|
||||
@ -67,41 +78,46 @@
|
||||
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
|
||||
|
||||
|
||||
<style>
|
||||
.odometer {
|
||||
font-size: 50px;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<style>
|
||||
.odometer {
|
||||
font-size: 50px;
|
||||
}
|
||||
</style>
|
||||
<body class="is-preload">
|
||||
|
||||
|
||||
<!-- Header -->
|
||||
<section id="header">
|
||||
<div class="inner">
|
||||
<img src="static/home/images/white.png" width="200" height="200">
|
||||
<h1><strong>reValuate</strong><br />
|
||||
</h1>
|
||||
{% if user.is_authenticated %}
|
||||
<p>Здравей, {{ user.username }}!</p><br>
|
||||
<p>Баланса ти е: {{ userBalance }} reCoins</p>
|
||||
<ul class="actions special">
|
||||
<section id="header">
|
||||
<div class="inner">
|
||||
|
||||
<img src="static/home/images/white.png" width="200" height="200">
|
||||
<h1><strong>reValuate</strong><br />
|
||||
</h1>
|
||||
{% if user.is_authenticated %}
|
||||
<p>Здравей, {{ user.username }}!</p>
|
||||
{% if userBalance %}
|
||||
<br><p>Баланса ти е: {{ userBalance }} reCoins</p>
|
||||
{% endif %}
|
||||
<ul class="actions special">
|
||||
<li><a href="/upload/" class="button scrolly">Качи!</a></li>
|
||||
<li><a href="/view_media/" class="button scrolly">Виж прогреса си!</a></li>
|
||||
<li><a href="/view_media/" class="button scrolly">Виж прогреса си!</a></li>
|
||||
|
||||
<li><a href="{% url 'logout' %}" class="button scrolly">Излез!</a></li>
|
||||
</ul>
|
||||
|
||||
{% else %}
|
||||
<p>Проект на тема разделно събиране.<br> Разработено от ученици от <a style="color:white; " href="https://edutech.bg">ЧПГ "Образователни технологии"</a></p>
|
||||
<ul class="actions special">
|
||||
<li><a href="#one" class="button scrolly">Кои сме ние</a></li>
|
||||
<li><a href="{% url 'logout' %}" class="button scrolly">Излез!</a></li>
|
||||
|
||||
</ul>
|
||||
{% else %}
|
||||
|
||||
<p>Проект на тема разделно събиране.<br> Разработено от ученици от <a style="color:white; " href="https://edutech.bg">ЧПГ "Образователни технологии"</a></p>
|
||||
<ul class="actions special">
|
||||
<li><a href="#one" class="button scrolly">Кои сме ние</a></li>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
<!-- One -->
|
||||
<section id="one" class="main style1">
|
||||
<div class="container">
|
||||
@ -212,7 +228,6 @@
|
||||
<li>© edutech</li><li>Design: <a href="https://github.com/yamozha">yamozha</a> and <a href=https://github.com/vassdeniss>vassdeniss</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
{% endif %}
|
||||
<!-- Scripts -->
|
||||
<script src="/static/home/js/jquery.min.js"></script>
|
||||
<script src=" /static/home/js/jquery.scrolly.min.js"></script>
|
||||
|
@ -1,26 +1,58 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %} My Images {% endblock %}
|
||||
{% block optionalParams %}
|
||||
<script src="https://www.w3schools.com/lib/w3.js"></script>
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css"/>
|
||||
<style>
|
||||
.posButtons{
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
margin-right: -50%;
|
||||
transform: translate(-50%, -50%);
|
||||
top: 80%;
|
||||
bottom: 20%;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
{% if user.is_authenticated %}
|
||||
Hi {{ user.username }}!<br>
|
||||
<div class="centered">
|
||||
|
||||
|
||||
{% for i in get_status reversed %}
|
||||
<img src="/media/{{ i.image }}" style="max-width:500px"/>
|
||||
{% if i.reason %}
|
||||
<span> cross</span>
|
||||
{% elif i.tokenized %}
|
||||
<span>checkmark</span>
|
||||
{% else %}
|
||||
<span> Processing </span>
|
||||
{% endif %}
|
||||
<div class="slide" width=500px height=500px>
|
||||
<img src="/media/{{ i.image }}" style=" display: block; margin: 0 auto; max-width:500px; max-height: 500px;"/>
|
||||
<p style="text-shadow: 0 0 2px #28a745; float: left;">{{forloop.counter}}/{{img_number}} <p style="text-shadow: 0 0 2px #28a745; float: right;">{{i.date}}</p></p>
|
||||
<br><br>
|
||||
{% if i.reason %}
|
||||
<p class="animate__animated animate__headShake" style="text-align: center;"> ❌ Снимката ти е маркирана като невалидна. Ако мислиш че има грешка ни изпратете <a href="mailto:boyan+revaluate@bobokara.com">имейл.</a> ❌</p>
|
||||
|
||||
{% elif i.tokenized %}
|
||||
<p class="animate__animated animate__tada" style="text-align: center;">✅ Снимката ти е валидна! Провери баланса си! ✅</p>
|
||||
|
||||
{% else %}
|
||||
<p class="animate__animated animate__pulse" style="text-align: center;"> ⏳ Снимката ти очаква обработка! ⏳ </p>
|
||||
|
||||
{% endif %}
|
||||
<br><br><br><br><br>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<div class="posButtons">
|
||||
<button class="Buttons" onclick="myShow.previous()">Предишнa</button>
|
||||
<button class="Buttons" onclick="myShow.next()">Следващa</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
myShow = w3.slideshow(".slide", 0);
|
||||
</script>
|
||||
|
||||
{% else %}
|
||||
<p>You are not logged in</p>
|
||||
<a href="{% url 'login' %}">Log In</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,24 +1,85 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %} Image Upload {% endblock %}
|
||||
{% block optionalParams%}
|
||||
<style>
|
||||
.checkmark__circle {
|
||||
stroke-dasharray: 166;
|
||||
stroke-dashoffset: 166;
|
||||
stroke-width: 2;
|
||||
stroke-miterlimit: 10;
|
||||
stroke: #7ac142;
|
||||
fill: none;
|
||||
animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
|
||||
}
|
||||
|
||||
.checkmark {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
stroke-width: 2;
|
||||
stroke: #fff;
|
||||
stroke-miterlimit: 10;
|
||||
margin: 10% auto;
|
||||
box-shadow: inset 0px 0px 0px #7ac142;
|
||||
animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
|
||||
}
|
||||
|
||||
.checkmark__check {
|
||||
transform-origin: 50% 50%;
|
||||
stroke-dasharray: 48;
|
||||
stroke-dashoffset: 48;
|
||||
animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
|
||||
}
|
||||
|
||||
@keyframes stroke {
|
||||
100% {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
@keyframes scale {
|
||||
0%, 100% {
|
||||
transform: none;
|
||||
}
|
||||
50% {
|
||||
transform: scale3d(1.1, 1.1, 1);
|
||||
}
|
||||
}
|
||||
@keyframes fill {
|
||||
100% {
|
||||
box-shadow: inset 0px 0px 0px 30px #7ac142;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="centered">
|
||||
{% if user.is_authenticated %}
|
||||
Hi {{ user.username }} {{ user.id }}!<br>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Upload</button>
|
||||
</form>
|
||||
|
||||
{% if img_obj %}
|
||||
<h3>Succesfully uploaded : {{img_obj.title}}</h3>
|
||||
<img src="{{ img_obj.image.url}}" alt="connect" style="max-height:300px">
|
||||
{% endif %}
|
||||
<div class="centered" style="text-align: center;">
|
||||
{% if user.is_authenticated %}
|
||||
{% if img_obj %}
|
||||
<h1 style="color:#7ac142;">Снимката ти е качена успешно!</h1>
|
||||
Кликни <a style="color:#7ac142;"href="/view_media/">тук</a>, ако искаш да я видиш!
|
||||
<svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
|
||||
<circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/>
|
||||
<path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
|
||||
</svg>
|
||||
{% else %}
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<label for="image" style="font-size: 32px;">Качи снимка! </label><br><br><br>
|
||||
<input id="image" type="file" name="image" required><br><br><br><br>
|
||||
<br>
|
||||
<button class="Buttons" type="submit">Качи!</button>
|
||||
</form>
|
||||
<br><br>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<p>You are not logged in</p>
|
||||
<a href="{% url 'login' %}">Log In</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p>You are not logged in</p>
|
||||
<a href="{% url 'login' %}">Log In</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
@ -1,24 +1,85 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %} Upload Video {% endblock %}
|
||||
{% block optionalParams%}
|
||||
<style>
|
||||
.checkmark__circle {
|
||||
stroke-dasharray: 166;
|
||||
stroke-dashoffset: 166;
|
||||
stroke-width: 2;
|
||||
stroke-miterlimit: 10;
|
||||
stroke: #7ac142;
|
||||
fill: none;
|
||||
animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
|
||||
}
|
||||
|
||||
.checkmark {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
display: block;
|
||||
stroke-width: 2;
|
||||
stroke: #fff;
|
||||
stroke-miterlimit: 10;
|
||||
margin: 10% auto;
|
||||
box-shadow: inset 0px 0px 0px #7ac142;
|
||||
animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s both;
|
||||
}
|
||||
|
||||
.checkmark__check {
|
||||
transform-origin: 50% 50%;
|
||||
stroke-dasharray: 48;
|
||||
stroke-dashoffset: 48;
|
||||
animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
|
||||
}
|
||||
|
||||
@keyframes stroke {
|
||||
100% {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
@keyframes scale {
|
||||
0%, 100% {
|
||||
transform: none;
|
||||
}
|
||||
50% {
|
||||
transform: scale3d(1.1, 1.1, 1);
|
||||
}
|
||||
}
|
||||
@keyframes fill {
|
||||
100% {
|
||||
box-shadow: inset 0px 0px 0px 30px #7ac142;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="centered">
|
||||
{% if user.is_authenticated %}
|
||||
Hi {{ user.username }}!<br>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Upload</button>
|
||||
</form>
|
||||
|
||||
{% if img_obj %}
|
||||
<h3>Succesfully uploaded : {{img_obj.title}}</h3>
|
||||
<source src="{{ img_obj.image.url}}" type="video/mp4" alt="connect" style="max-height:300px">
|
||||
{% endif %}
|
||||
<div class="centered" style="text-align: center;">
|
||||
{% if user.is_authenticated %}
|
||||
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
<label for="video" style="font-size: 32px;">Качи видео! </label><br><br><br>
|
||||
<input id="video" type="file" name="video" required><br><br><br><br>
|
||||
<br>
|
||||
<button class="Buttons" type="submit">Качи!</button>
|
||||
</form>
|
||||
<br><br>
|
||||
{% if img_obj %}
|
||||
<h1 style="color:#7ac142;">Видеото ти е качено успешно!</h1>
|
||||
<svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52">
|
||||
<circle class="checkmark__circle" cx="26" cy="26" r="25" fill="none"/>
|
||||
<path class="checkmark__check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"/>
|
||||
</svg>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
<p>You are not logged in</p>
|
||||
<a href="{% url 'login' %}">Log In</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p>You are not logged in</p>
|
||||
<a href="{% url 'login' %}">Log In</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from django import forms
|
||||
from .models import Image, Videos
|
||||
from .models import Image
|
||||
|
||||
|
||||
class ImageForm(forms.ModelForm):
|
||||
@ -8,8 +8,8 @@ class ImageForm(forms.ModelForm):
|
||||
model = Image
|
||||
fields = ('image',)
|
||||
|
||||
class VideoForm(forms.ModelForm):
|
||||
"""Form for the image model"""
|
||||
class Meta:
|
||||
model = Videos
|
||||
fields = ('video',)
|
||||
# class VideoForm(forms.ModelForm):
|
||||
# """Form for the image model"""
|
||||
# class Meta:
|
||||
# model = Videos
|
||||
# fields = ('video',)
|
||||
|
22
reValuate/upload/migrations/0013_auto_20210315_0340.py
Normal file
@ -0,0 +1,22 @@
|
||||
# Generated by Django 3.1.6 on 2021-03-15 01:40
|
||||
|
||||
import datetime
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('upload', '0012_auto_20210312_2347'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='image',
|
||||
name='date',
|
||||
field=models.DateField(default=datetime.date.today),
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='Videos',
|
||||
),
|
||||
]
|
18
reValuate/upload/migrations/0014_image_time.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.6 on 2021-03-15 01:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('upload', '0013_auto_20210315_0340'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='image',
|
||||
name='time',
|
||||
field=models.TimeField(auto_now=True),
|
||||
),
|
||||
]
|
@ -1,6 +1,7 @@
|
||||
from django.db import models
|
||||
from .validators import videoValidate, imageValidate
|
||||
from django.contrib.auth.models import User
|
||||
from datetime import date
|
||||
|
||||
|
||||
# def user_directory._path(instance, filename):
|
||||
@ -22,19 +23,22 @@ class Image(models.Model):
|
||||
image = models.ImageField(upload_to=imagesPath,validators=[imageValidate], unique=True)
|
||||
tokenized = models.BooleanField(blank=True, null=True, default=None, max_length=3)
|
||||
reason = models.CharField(max_length=120)
|
||||
date = models.DateField(default=date.today)
|
||||
time = models.TimeField(auto_now=True)
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'image'
|
||||
verbose_name_plural = 'images'
|
||||
|
||||
class Videos(models.Model):
|
||||
user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True)
|
||||
video = models.FileField(upload_to=videosPath, validators=[videoValidate])
|
||||
tokenized = models.BooleanField(blank=True, null=True, default=None, max_length=3)
|
||||
reason = models.CharField(max_length=120)
|
||||
# class Videos(models.Model):
|
||||
# user = models.ForeignKey(User, on_delete=models.CASCADE, blank=True, null=True)
|
||||
# video = models.FileField(upload_to=videosPath, validators=[videoValidate])
|
||||
# tokenized = models.BooleanField(blank=True, null=True, default=None, max_length=3)
|
||||
# reason = models.CharField(max_length=120)
|
||||
|
||||
|
||||
|
||||
class Meta:
|
||||
verbose_name = 'video'
|
||||
verbose_name_plural = 'videos'
|
||||
# class Meta:
|
||||
# verbose_name = 'video'
|
||||
# verbose_name_plural = 'videos'
|
||||
|
@ -1,9 +1,9 @@
|
||||
from django.shortcuts import render, redirect
|
||||
import os.path
|
||||
import os
|
||||
from .forms import ImageForm, VideoForm
|
||||
from .forms import ImageForm
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
from .models import Image, Videos
|
||||
from .models import Image
|
||||
from django.conf import settings
|
||||
|
||||
def uploadContent(request):
|
||||
@ -34,36 +34,35 @@ def imageUpload(request):
|
||||
img_obj.user = request.user
|
||||
form.save()
|
||||
return render(request, 'uploadImage.html', {'form': form, 'img_obj': img_obj})
|
||||
|
||||
|
||||
else:
|
||||
form = ImageForm()
|
||||
return render(request, 'uploadImage.html', {'form': form})
|
||||
|
||||
def videoUpload(request):
|
||||
"""Process videos uploaded by users"""
|
||||
if request.method == 'POST':
|
||||
form = VideoForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
userIdModel = Videos.objects.filter(user=request.user.id)
|
||||
img_obj = form.instance
|
||||
img_obj.user = request.user
|
||||
form.save()
|
||||
return render(request, 'uploadVideo.html', {'form': form, 'img_obj': img_obj})
|
||||
# def videoUpload(request):
|
||||
# """Process videos uploaded by users"""
|
||||
# if request.method == 'POST':
|
||||
# form = VideoForm(request.POST, request.FILES)
|
||||
# if form.is_valid():
|
||||
# userIdModel = Videos.objects.filter(user=request.user.id)
|
||||
# img_obj = form.instance
|
||||
# img_obj.user = request.user
|
||||
# form.save()
|
||||
# return render(request, 'uploadVideo.html', {'form': form, 'img_obj': img_obj})
|
||||
|
||||
else:
|
||||
form = VideoForm()
|
||||
return render(request, 'uploadVideo.html', {'form': form})
|
||||
# else:
|
||||
# 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}/")
|
||||
get_status = Image.objects.filter(user_id=request.user.id)
|
||||
|
||||
img_list = os.listdir(settings.MEDIA_ROOT + f"images/{request.user.id}/")
|
||||
|
||||
context = {
|
||||
"images": img_list,
|
||||
"id":request.user.id,
|
||||
"get_status":get_status,
|
||||
"img_number": len(img_list)-1,
|
||||
}
|
||||
return render (request, 'showAllImage.html', context)
|
||||
|
||||
|
@ -5,7 +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
|
||||
from upload.models import Image
|
||||
|
||||
# need to make oauth facebook login
|
||||
class SignUpView(generic.CreateView):
|
||||
@ -66,8 +66,8 @@ def getBalance(request):
|
||||
def adminView(request):
|
||||
try:
|
||||
latestPicture = Image.objects.filter(tokenized=None)
|
||||
latestPicture, userId = latestPicture.values("image")[0]["image"], latestPicture.values("user_id")[0]["user_id"]
|
||||
|
||||
latestPicture, userId, date, time = latestPicture.values("image")[0]["image"], latestPicture.values("user_id")[0]["user_id"], latestPicture.values("date")[0]["date"], latestPicture.values("time")[0]["time"]
|
||||
username = User.objects.get(pk=userId)
|
||||
if request.method == "POST":
|
||||
if request.POST['isValid'] == "Valid":
|
||||
try:
|
||||
@ -90,11 +90,11 @@ def adminView(request):
|
||||
imageObj.tokenized=True
|
||||
imageObj.reason="Invalid"
|
||||
imageObj.save()
|
||||
return render(request, "adminView.html", {"image":latestPicture, "userId":userId})
|
||||
return render(request, "adminView.html", {"time":time, "date":date,"image":latestPicture, "userId":userId, "username":username})
|
||||
|
||||
|
||||
else:
|
||||
return render(request, "adminView")
|
||||
return render(request, "adminView.html", {"image":latestPicture, "userId":userId})
|
||||
return render(request, "adminView.html", {"time":time, "date":date,"image":latestPicture, "userId":userId, "username":username})
|
||||
except IndexError:
|
||||
return render(request, "adminView.html")
|
||||
|
@ -31,6 +31,7 @@ DEBUG = True
|
||||
ALLOWED_HOSTS = [
|
||||
"cleener.xyz",
|
||||
"www.cleener.xyz",
|
||||
"127.0.0.1"
|
||||
]
|
||||
|
||||
|
||||
|
@ -20,18 +20,18 @@ from django.conf import settings
|
||||
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 upload.views import uploadContent, imageUpload, viewMedia
|
||||
from users.views import getBalance, addToBalance, adminView
|
||||
urlpatterns = [
|
||||
path("", homePage, name='home'),
|
||||
|
||||
path("users/", include('django.contrib.auth.urls')),
|
||||
path('users/', include('users.urls')),
|
||||
path("upload/", uploadContent, name="Upload"),
|
||||
path("upload_image/", imageUpload, name="Image"),
|
||||
path("upload_video/", videoUpload, name="Video"),
|
||||
# path("upload/", uploadContent, name="Upload"),
|
||||
path("upload/", imageUpload, name="Image"),
|
||||
# path("upload_video/", videoUpload, name="Video"),
|
||||
path("view_media/", viewMedia, name="All Media"),
|
||||
path("get_balance/",getBalance, name="Balance" ),
|
||||
# path("get_balance/",getBalance, name="Balance" ),
|
||||
path("add_balance/", addToBalance, name="Add"),
|
||||
path("admin/", adminView, name="admin")
|
||||
]
|
||||
|